Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

confbox

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

confbox

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

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.6M
increased by4.41%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 20 Feb 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc