{"library":"smol-toml","title":"Small and Fast TOML Parser","type":"library","description":"smol-toml is a JavaScript and TypeScript library designed for parsing and serializing TOML (Tom's Obvious, Minimal Language) documents. Currently at version 1.6.1, it offers a small, fast, and highly compliant implementation of the TOML specification, supporting the latest TOML 1.1.0 standard since version 1.6.0. It maintains a regular release cadence with recent updates addressing security vulnerabilities and feature enhancements. Differentiating itself from other often outdated or unmaintained TOML parsers in the JavaScript ecosystem, smol-toml is noted as the most downloaded TOML parser on npm, actively used in production systems. While generally robust, it explicitly notes some non-compliance with the `toml-test` suite for performance reasons, such as not rejecting invalid UTF-8 or certain invalid dates. It also provides options for handling integers as BigInts to prevent precision loss, a feature introduced in v1.4.0.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install smol-toml"],"cli":null},"imports":["import { parse } from 'smol-toml'","import { stringify } from 'smol-toml'","import TOML from 'smol-toml'"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/squirrelchat/smol-toml","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/smol-toml","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import { parse, stringify } from 'smol-toml';\n\nconst tomlDoc = `\n[database]\ndriver = \"postgresql\"\nserver.host = \"127.0.0.1\"\nserver.port = 3307\nfloat_val = 1.0\nint_val = 9223372036854775807\n`;\n\nconsole.log('--- Original TOML Document ---');\nconsole.log(tomlDoc);\n\n// Parse the TOML document\nconst parsedConfig = parse(tomlDoc, { parseBigInt: true }); // parseBigInt for large integers\nconsole.log('\\n--- Parsed JavaScript Object ---');\nconsole.log(JSON.stringify(parsedConfig, null, 2));\n\n// Stringify the JavaScript object back to TOML\nconst stringifiedToml = stringify(parsedConfig);\nconsole.log('\\n--- Stringified TOML Document ---');\nconsole.log(stringifiedToml);\n\n// Example with default export\nimport TOML from 'smol-toml';\nconst parsedWithDefault = TOML.parse(tomlDoc);\nconsole.log('\\n--- Parsed with default export ---');\nconsole.log(JSON.stringify(parsedWithDefault.database, null, 2));\n","lang":"typescript","description":"Demonstrates parsing a TOML string into a JavaScript object and then stringifying the object back into a TOML string, including options for BigInt parsing.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}