0.2.0 • Published 2 months ago

jsonc-reader v0.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

JSONC reader for TypeScript

test status Code Coverage 0 dependencies install size

This micro-library (no dependencies) allows reading JSON that contain comments (JSONC). It does that by stripping comments and then loading the data as normal JSON.

import * as jsonc from "jsonc-reader"

// load JSONC from a file
const config = await jsonc.load("../my-config.jsonc")

// parse a JSONC string
const jsoncText = `
{
  // a comment
  "one": 1  // another comment
}`
const config = jsonc.parse(jsoncText)
// config === { one: 1 }

// strip comments from a JSONC string
const jsonText = jsonc.strip(jsoncText)
// jsonText === `
// {
//   "one": 1
// }`
0.1.0

2 months ago

0.1.2

2 months ago

0.2.0

2 months ago

0.1.1

2 months ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago