mirror of
https://github.com/tauri-apps/tauri-toml.git
synced 2026-02-04 10:21:17 +01:00
b54bb9b3f7f483572bec04cc067f75866afdce20
@iarna/toml
JSON-like bindings for TOML.
Example
var TOML = require('@iarna/toml')
var obj = TOML.parse(`[abc]
foo = 123
bar = [1,2,3]`)
/* obj =
{abc: {foo: 123, bar: [1,2,3]}}
*/
var str = TOML.stringify(obj)
/* str =
[abc]
foo = 123
bar = [ 1, 2, 3 ]
*/
The parser is provided by toml. We provide our own stringifier.
What's Missing
- Any way to produce comments. As a JSON stand-in I'm not too worried about this.
- Error reporting in stringification that's not terrible. Right now it's basically "it broke". Making this better will not be difficult. Error reporting is important because there are datastructures TOML can't represent.
Tests
The tests for the stringifier are made up of two parts:
First, we verify that we can round-trip all of the examples provided in the toml spec repository. They were fetched as of 183273af30102704a103f206f974636967c4da6d and specifically are:
Second, many tests are borrowed from @othiym23's toml-stream module. They were fetched as of b6f1e26b572d49742d49fa6a6d11524d003441fa.
Languages
JavaScript
100%