toml

WebJar for toml

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

toml
Last Version

Last Version

2.3.3
Release Date

Release Date

Type

Type

jar
Description

Description

toml
WebJar for toml
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/BinaryMuse/toml-node

Download toml

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/toml/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>toml</artifactId>
    <version>2.3.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/toml/
implementation 'org.webjars.npm:toml:2.3.3'
// https://jarcasting.com/artifacts/org.webjars.npm/toml/
implementation ("org.webjars.npm:toml:2.3.3")
'org.webjars.npm:toml:jar:2.3.3'
<dependency org="org.webjars.npm" name="toml" rev="2.3.3">
  <artifact name="toml" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='toml', version='2.3.3')
)
libraryDependencies += "org.webjars.npm" % "toml" % "2.3.3"
[org.webjars.npm/toml "2.3.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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.

Versions

Version
2.3.3