JSPM

@luxass/strip-json-comments

1.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5308
  • Score
    100M100P100Q147796F
  • License MIT

strip comments from your json

Package Exports

  • @luxass/strip-json-comments
  • @luxass/strip-json-comments/package.json

Readme

strip-json-comments

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

📦 Installation

pnpm add @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 a named export called strip
- import stripJsonComments from "strip-json-comments";
+ import { strip } from "@luxass/strip-json-comments";

💻 Development

  • Clone this repository
  • Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10)
  • Install dependencies using pnpm install
  • Run tests using pnpm dev

📄 License

Published under MIT License.