All Projects → BinaryMuse → Toml Node

BinaryMuse / Toml Node

Licence: mit
TOML parser for Node.js and the Browser. Parses TOML v0.4.0

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Toml Node

Tomlet
Zero-Dependency, model-based TOML De/Serializer for .NET
Stars: ✭ 56 (-78.04%)
Mutual labels:  toml
Molten
[WIP] Molten - Style-preserving TOML parser.
Stars: ✭ 36 (-85.88%)
Mutual labels:  toml
goconf
Configuration loader in Go
Stars: ✭ 23 (-90.98%)
Mutual labels:  toml
tomlcpp
No fanfare TOML C++ Library
Stars: ✭ 21 (-91.76%)
Mutual labels:  toml
tomlify-j0.4
An Object->TOML encoder/converter for TOML v0.4.0 (not v0.4.x)
Stars: ✭ 16 (-93.73%)
Mutual labels:  toml
pytomlpp
A python wrapper for tomlplusplus
Stars: ✭ 56 (-78.04%)
Mutual labels:  toml
climatecontrol
Python library for loading settings and config data from files and environment variables
Stars: ✭ 20 (-92.16%)
Mutual labels:  toml
j-toml
A Node.js implementation of TOML written by LongTengDao. Belong to "Plan J"./龙腾道为汤小明语写的 Node.js 实现。从属于“简计划”。
Stars: ✭ 21 (-91.76%)
Mutual labels:  toml
parse it
A python library for parsing multiple types of config files, envvars & command line arguments that takes the headache out of setting app configurations.
Stars: ✭ 86 (-66.27%)
Mutual labels:  toml
rubric
Linter Config Initializer for Python
Stars: ✭ 21 (-91.76%)
Mutual labels:  toml
audible-cli
A command line interface for audible package. With the cli you can download your Audible books, cover, chapter files.
Stars: ✭ 142 (-44.31%)
Mutual labels:  toml
tomlj
A Java parser for Tom's Obvious, Minimal Language (TOML).
Stars: ✭ 72 (-71.76%)
Mutual labels:  toml
configo
Configo is a go library to parse toml configuration using struct tags
Stars: ✭ 33 (-87.06%)
Mutual labels:  toml
front-matter
The most featured front matter (yaml, json, neon, toml) parser and dumper for PHP.
Stars: ✭ 23 (-90.98%)
Mutual labels:  toml
fstoml
Lightweight TOML based F# project file
Stars: ✭ 36 (-85.88%)
Mutual labels:  toml
transfer
Converts from one encoding to another. Supported formats HCL ⇄ JSON ⇄ YAML⇄TOML⇄XML⇄plist⇄pickle⇄properties ...
Stars: ✭ 70 (-72.55%)
Mutual labels:  toml
tomland
🏝 Bidirectional TOML serialization
Stars: ✭ 103 (-59.61%)
Mutual labels:  toml
toml-sort
Toml sorting library
Stars: ✭ 31 (-87.84%)
Mutual labels:  toml
qtoml
Another Python TOML encoder/decoder
Stars: ✭ 26 (-89.8%)
Mutual labels:  toml
TOMLDecoder
From TOML to Swift Codable types.
Stars: ✭ 52 (-79.61%)
Mutual labels:  toml

TOML Parser for Node.js

Build Status

NPM

If you haven't heard of TOML, well you're just missing out. Go check it out now. Back? Good.

TOML Spec Support

toml-node supports version 0.4.0 the TOML spec as specified by mojombo/[email protected]

Installation

toml-node is available via npm.

npm install toml

toml-node also works with browser module bundlers like Browserify and webpack.

Usage

Standalone

Say you have some awesome TOML in a variable called someTomlString. Maybe it came from the web; maybe it came from a file; wherever it came from, it came asynchronously! Let's turn that sucker into a JavaScript object.

var toml = require('toml');
var data = toml.parse(someTomlString);
console.dir(data);

toml.parse throws an exception in the case of a parsing error; such exceptions have a line and column property on them to help identify the offending text.

try {
  toml.parse(someCrazyKnuckleHeadedTrblToml);
} catch (e) {
  console.error("Parsing error on line " + e.line + ", column " + e.column +
    ": " + e.message);
}

Streaming

As of toml-node version 1.0, the streaming interface has been removed. Instead, use a module like concat-stream:

var toml = require('toml');
var concat = require('concat-stream');
var fs = require('fs');

fs.createReadStream('tomlFile.toml', 'utf8').pipe(concat(function(data) {
  var parsed = toml.parse(data);
}));

Thanks @ForbesLindesay for the suggestion.

Requiring with Node.js

You can use the toml-require package to require() your .toml files with Node.js

Live Demo

You can experiment with TOML online at http://binarymuse.github.io/toml-node/, which uses the latest version of this library.

Building & Testing

toml-node uses the PEG.js parser generator.

npm install
npm run build
npm test

Any changes to src/toml.peg requires a regeneration of the parser with npm run build.

toml-node is tested on Travis CI and is tested against:

  • Node 0.10
  • Node 0.12
  • Latest stable io.js

License

toml-node is licensed under the MIT license agreement. See the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].