Socket
Socket
Sign inDemoInstall

confbox

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    confbox

Compact and high quality YAML, TOML, JSONC and JSON5 parsers


Version published
Maintainers
1
Install size
243 kB
Created

Changelog

Source

v0.1.1

💅 Refactors

  • Consistent casing (58f6130)

🏡 Chore

✅ Tests

  • Add test with full coverage (7bc81b8)

❤️ Contributors

Readme

Source

confbox

npm version npm downloads

Config parsers for:

YAML (with js-yaml)

TOML (with toml

JSONC (with jsonc-parser)

JSON5 (with json5)

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 (tree-shakable)
import {
  parseJSON5,
  parseJSONC,
  parseTOML,
  parseYAML,
  stringifyYAML,
} from "confbox";

// Using individual builds
import { parseYAML, stringifyYAML } from "confbox/yaml";
import { parseTOML } from "confbox/toml";
import { parseJSON5 } from "confbox/json5";
import { parseJSONC } from "confbox/jsonc";

// CommonJS
const {
  parseJSON5,
  parseJSONC,
  parseTOML,
  parseYAML,
  stringifyYAML,
} = require("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.

Development

  • Clone this repository
  • Install the latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with 💛

Published under MIT License.

Keywords

FAQs

Last updated on 20 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc