@luxass/strip-json-comments
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published

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.

/@luxass/strip-json-comments/

    Package Sidebar

    Install

    npm i @luxass/strip-json-comments

    Weekly Downloads

    1,134

    Version

    1.3.2

    License

    MIT

    Unpacked Size

    13 kB

    Total Files

    7

    Last publish

    Collaborators

    • luxass