吕君喜 406d880ac6 first | hace 3 años | |
---|---|---|
.. | ||
cli.js | hace 3 años | |
license | hace 3 años | |
package.json | hace 3 años | |
readme.md | hace 3 años | |
strip-json-comments.js | hace 3 años |
Strip comments from JSON. Lets you use comments in your JSON files!
This is now possible:
{
// rainbows
"unicorn": /* ❤ */ "cake"
}
It will remove single-line comments //
and multi-line comments /**/
.
Also available as a gulp/grunt/broccoli plugin.
-
There's also json-comments
, but it's only for Node.js, inefficient, bloated as it also minifies, and comes with a require
hook, which is :(
$ npm install --save strip-json-comments
$ bower install --save strip-json-comments
$ component install sindresorhus/strip-json-comments
var json = '{/*rainbows*/"unicorn":"cake"}';
JSON.parse(stripJsonComments(json));
//=> {unicorn: 'cake'}
Type: string
Accepts a string with JSON and returns a string without comments.
$ npm install --global strip-json-comments
$ strip-json-comments --help
strip-json-comments input-file > output-file
# or
strip-json-comments < input-file > output-file
MIT © Sindre Sorhus