@luxass/strip-json-comments
v1.3.2
Published
strip comments from your json
Downloads
5,338
Maintainers
Readme
strip-json-comments
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" }
Differences to sindresorhus/strip-json-comments
The main differences are:
- This package is published as ESM & CJS
- And the
default export
is moved to anamed export
calledstrip
- import stripJsonComments from "strip-json-comments";
+ import { strip } from "@luxass/strip-json-comments";
📄 License
Published under MIT License.