@tabnas/toml
v0.2.0
Published
This plugin allows the [Jsonic](https://github.com/tabnas/jsonic) JSON parser to support toml syntax.
Maintainers
Readme
@tabnas/toml (TypeScript / JavaScript)
A TOML parser, built as a Jsonic grammar plugin on the tabnas engine. Parses TOML source into plain JavaScript objects.
Install
npm install @tabnas/toml @tabnas/parser @tabnas/jsonicExample
const { Tabnas } = require('@tabnas/parser')
const { jsonic } = require('@tabnas/jsonic')
const { Toml } = require('@tabnas/toml')
const toml = new Tabnas().use(jsonic).use(Toml)
toml.parse('a = 1\nb = [2, 3]') // => { a: 1, b: [2, 3] }Build the toml instance once and reuse it; building it installs the
whole grammar, while parsing is cheap.
Documentation
Organised around the Diataxis framework:
- Tutorial — a step-by-step first parse.
- How-to guide — task-oriented recipes.
- Reference — the API, value mapping, and accepted grammar.
- Concepts — how the plugin works and why.
Options
None. TomlOptions is currently an empty object type.
Grammar diagram
The installed grammar as a railroad/syntax diagram, generated with
@tabnas/railroad:
A vertical ASCII version is in doc/grammar.txt.
References
String handling adapted from https://github.com/huan231/toml-nodejs (MIT).
License
MIT. Copyright (c) Richard Rodger and other contributors.
