gizlang/toml
TOML 1.0 text to the JSON value model (gizlang/json Json) and back.
- parse reads a document into an object. Tables, arrays of tables, dotted keys and inline tables nest as objects and arrays; integers and floats are numbers (f64: an integer past 2^53 loses its low digits); a date, a time or a date-time is a string of its text. A key defined twice, a table defined twice or a table extended after it was closed (an inline table, an array) is an error with its line. - stringify writes an object: its plain keys first, then each table under a header and each array of objects as an array of tables, so parse gives the value back. TOML has no null: a null field is left out, and a null in an array is an error.
import * as Toml from "gizlang/toml";Types
TomlError
type TomlError = { line: i64; message: string; }Where a text stops being TOML (its line, from 1), or why a value has no TOML form (line 0).
line:i64message:string
Functions
parse
function parse(text: string): Json throws TomlErrorThe document TEXT as an object.
Effects: fail, alloc.
stringify
function stringify(value: Json): string throws TomlErrorVALUE, an object, as a TOML document.
Effects: fail, alloc.