DEV Community

Mr Smithnen
Mr Smithnen

Posted on

YINI Parser Hits Beta - Human-Friendly, Modern Config Format with Minimal Syntax Noise

๐Ÿš€ YINI Parser 1.0.0 Beta 1 is out!

If you're tired of bloated, hard-to-read configuration formats. Or just looking for something truly human-friendly, simple section nesting, etc - Check out YINI: a modern, minimal configuration file format, now with a TypeScript parser for Node.js.

This beta release includes:

  • The parser is now in beta - moved from alpha status, reflecting increased stability and feature completeness.
  • Cleaned up exports to support importing this library in both CommonJS (CJS) and ECMAScript Modules (ESM) environments.
  • Implemented full support for parsing YINI lists, according to the latest specification.
  • Updated the grammar and parsing logic to match the latest YINI specification v1.0.0-RC.1.
  • An expanding set of real-world fixtures and tests.

Quick Start

A minimal example using YINI in TypeScript:

import YINI from 'yini-parser'

const config = YINI.parse(`
^ App
name     = 'My Title'    // App display name.
items    = 25
darkMode = true

    // Sub-section of App.
    ^^ Special
    primaryColor = #336699
    isCaching = false
`)

// To parse from a file instead:
// const config = YINI.parseFile('./config.yini')

console.log(config.App.name)                // My Title
console.log(config.App.Special.isCaching)   // false
console.log()
console.log(config)
Enter fullscreen mode Exit fullscreen mode

Output:

My Title
false

{
  App: {
    name: 'My Title',
    items: 25,
    darkMode: true,
    Special: { 
      primaryColor: 3368601,
      isCaching: false
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

That's it!

And installation in Node.js is just:

npm install yini-parser
Enter fullscreen mode Exit fullscreen mode

The library is out on npm here: YINI Parser on npm, so you can try it out for real :P

If you like what you reading, I want to get more into the YINI format: Here's intro to YINI Config Format.

Questions, feedback, or bugs? Open an issue on GitHub or drop a comment below!

Thanks for reading!

  • Marko Seppรคnen

:)

Top comments (0)