What problem does it solve?
Provides a compact, spec-compliant way to parse and serialize TOML configuration files into JavaScript objects, removing the friction of handling TOML syntax, date/time semantics, and parse diagnostics across runtimes.
Core Features & Use Cases
- Parse TOML text into JavaScript-friendly types with a clear TOML-to-JavaScript mapping, including strings, numbers, bigint for out-of-range integers, booleans, arrays, tables, and TomlDate for all TOML date/time variants.
- Serialize JavaScript objects back to valid TOML while preserving TomlDate formats and correctly emitting arrays, tables, and array-of-tables.
- TomlError provides precise line and column diagnostics with a code snippet pointer for robust error reporting during config loading and validation.
- Cross-runtime support for Bun, Node, Deno, and ESM browsers makes it suitable for CLI tools, application config loading, and build-time tooling.
Quick Start
Read a config.toml file, parse it into a JavaScript object, update the configuration values, and write it back to disk using the library's parse and stringify functions.