Official TypeScript / JavaScript YINI Parser

Parse YINI configuration files in TypeScript/JavaScript and Node.js.

The official TypeScript/JavaScript parser is the primary YINI parser implementation. It is designed to make YINI easy to use in Node.js applications, scripts, tools, and services.

If you want a configuration format that stays readable for humans while still being structured and predictable for software, a YINI parser gives you a simple way to work with it in code.


Install

npm install yini-parser

Then import it in your project:

import YINI from 'yini-parser'

Quick example

Suppose you have this YINI content:

^ App
name = "My App Title"
version = "1.2.3"
pageSize = 25
darkTheme = off

You can parse it like this:

import YINI from 'yini-parser'

const config = YINI.parse(`
^ App
name = "My App Title"
version = "1.2.3"
pageSize = 25
darkTheme = off
`)

console.log(config.App.name)
console.log(config.App.darkTheme)

Output:

My App Title
false

Parse from a file

If your configuration is stored in a file, you can parse it directly:

import YINI from 'yini-parser'

const config = YINI.parseFile('./config.yini')

console.log(config.App.version)

What you get back

The parser returns normal JavaScript objects, so the result is easy to use in your application code.

^ App
name = 'My Title'
items = 25
darkMode = true

    ^^ Special
    primaryColor = 0x336699
    isCaching = false

Becomes:

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

Why use YINI in code?

YINI is designed to be:

  • Human-friendly β€” easy to read and write.
  • Explicit β€” structure is clear and not controlled by indentation.
  • Structured β€” supports nested sections, lists, booleans, numbers, strings, and inline objects.
  • Predictable β€” built around clear parsing rules.

Common use cases

This parser is a good fit if you want:

  • Application configuration loaded at runtime.
  • Readable configuration files for internal tools.
  • A parser for Node.js or TypeScript projects.
  • Structured config without indentation-based structure.
  • A format that can later also be used with the YINI CLI.

If you want to work with YINI from the command line, see the YINI CLI page.

The CLI is useful for:

  • Validating YINI files from the CLI/terminal.
  • Converting YINI to JSON or JavaScript.
  • Inspecting configuration from the terminal.

For example projects showing YINI usage in Python, JavaScript, and TypeScript see:
YINI demo apps β†—


Learn more


If you want to try the parser or explore the project further, these links are a good place to continue.