Package Exports
- confbox
- confbox/json5
- confbox/jsonc
- confbox/toml
- confbox/yaml
Readme
confbox
Config parsers for:
✅ JSONC (with jsonc-parser
)
With perfect bundling:
✨ Types exported out of the box
✨ Zero config and compact redistribution
✨ Dual ESM/CJS build
✨ Consistent and tested API
✨ Handpicked best libraries (bundle+perf)
[!NOTE] Use unjs/c12 for a full featured configuration loader!
Usage
Install package:
# ✨ Auto-detect
npx nypm i confbox
# npm
npm install confbox
# yarn
yarn add confbox
# pnpm
pnpm install confbox
# bun
bun install confbox
Import:
ESM (Node.js, Bun)
import {
parseJSON5,
parseJSONC,
parseYAML,
stringifyYAML,
parseTOML,
} from "confbox";
CommonJS (Legacy Node.js)
const {
parseJSON5,
parseJSONC,
parseYAML,
stringifyYAML,
parseTOML,
} = require("confbox");
CDN (Deno, Bun and Browsers)
import {
parseJSON5,
parseJSONC,
parseYAML,
stringifyYAML,
parseTOML,
} from "https://esm.sh/confbox";
parseJSON5(text, options?)
Converts a JSON5 string into an object.
parseJSONC(text, options?)
Converts a JSONC string into an object.
parseTOML(text)
Converts a TOML string into an object.
parseYAML(text, options?)
Converts a YAML string into an object.
stringifyYAML(value, options?)
Converts a JavaScript value to a YAML string.
Contribution
Local development
License
Published under the MIT license.
Made by @pi0 and community 💛
🤖 auto updated with automd (last updated: Tue Feb 20 2024)