6.1.1 • Published 12 months ago
json2toml v6.1.1
json2toml
Convert JSON to TOML.
Example
const json2toml = require('json2toml');
json2toml({simple: true});
// => 'simple = true\n'
// Also supports pretty-printing options
json2toml(
{
deeply: {
option: false,
nested: {
option: true
}
}
},
{ indent: 2, newlineAfterSection: true }
);
// => [deeply]
// => option = false
// =>
// => [deeply.nested]
// => option = true
Installation
$ npm install json2toml
API
const json2toml = require('json2toml');
json2toml(hash, options = {})
Converts an Object hash
to TOML, and returns the result as a String.
options.indent
: Number of spaces for indentation.options.newlineAfterSection
: Whether or not to output a newline after the last pair in a hash if that hash wasn't empty.
Throws a TypeError
if undefined
, null
, or a sparse array is encountered.
6.1.1
12 months ago
6.1.0
1 year ago
6.0.0
2 years ago
5.0.0
2 years ago
4.0.2
2 years ago
4.0.1
3 years ago
4.0.0
3 years ago
3.0.1
3 years ago
3.0.0
3 years ago
2.2.1
4 years ago
2.2.0
4 years ago
2.1.0
4 years ago
2.0.2
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.0.6
9 years ago
1.0.5
9 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
11 years ago
1.0.0
11 years ago