luxass / strip-json-comments

strip comments from your json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

strip-json-comments

npm version npm downloads

A fork of sindresorhus/strip-json-comments but with support for CJS & ESM. And some small modifications.

πŸ“¦ Installation

npm install @luxass/strip-json-comments

πŸ“š Usage

There is a small difference to the original package. You can see it here.

import { strip } from "@luxass/strip-json-comments";

const json = `{
  // this is a comment
  "foo": /* this is also a comment */ "bar"
}`;

JSON.parse(strip(json)); // { foo: "bar" }

The main differences are:

  • This package is published as ESM & CJS
  • And the default export is moved to a named export called strip
- import stripJsonComments from "strip-json-comments";
+ import { strip } from "@luxass/strip-json-comments";

πŸ“„ License

Published under MIT License.

About

strip comments from your json

License:MIT License


Languages

Language:TypeScript 99.2%Language:JavaScript 0.8%