Works with
•JSR Score76%•It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun




Published2 years ago (0.215.0)
- @std/toml
all symbols
default
parse and stringify for handling
TOML encoded data. Be sure to read the supported
types as not every spec is supported at the moment and the handling in
TypeScript side is a bit different.
Examples
Example 1
Example 1
import { parse, stringify, } from "@std/toml"; const obj = { bin: [ { name: "deno", path: "cli/main.rs" }, { name: "deno_core", path: "src/foo.rs" }, ], nib: [{ name: "node", path: "not_found" }], }; const tomlString = stringify(obj); console.log(tomlString); // => // [[bin]] // name = "deno" // path = "cli/main.rs" // [[bin]] // name = "deno_core" // path = "src/foo.rs" // [[nib]] // name = "node" // path = "not_found" const tomlObject = parse(tomlString); console.log(tomlObject); // => // { // bin: [ // { name: "deno", path: "cli/main.rs" }, // { name: "deno_core", path: "src/foo.rs" } // ], // nib: [ { name: "node", path: "not_found" } ] // }
Functions
Interfaces
I
Formatting Options for stringify
- keyAlignment: boolean
Define if the keys should be aligned or not
parse
Functions
f
parse(tomlString: string): Record<string, unknown>
Parse parses TOML string into an object.
stringify
Functions
f
stringify(): string
srcObj: Record<string, unknown>,
fmtOptions?: FormatOptions
Stringify dumps source object into TOML string and returns it.
Interfaces
I
Formatting Options for stringify
- keyAlignment: boolean
Define if the keys should be aligned or not