1
0
Fork 0
arangodb/js/node/node_modules/eslint/node_modules/strip-json-comments
Alan Plum cf302adf26
Always use --global-style when installing npm deps
This partially reverts commit 8a286a30d9.
2016-07-14 16:29:20 +02:00
..
cli.js
license
package.json
readme.md
strip-json-comments.js

readme.md

strip-json-comments Build Status

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 :(

Install

$ npm install --save strip-json-comments
$ bower install --save strip-json-comments
$ component install sindresorhus/strip-json-comments

Usage

var json = '{/*rainbows*/"unicorn":"cake"}';
JSON.parse(stripJsonComments(json));
//=> {unicorn: 'cake'}

API

stripJsonComments(input)

input

Type: string

Accepts a string with JSON and returns a string without comments.

CLI

$ 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

License

MIT © Sindre Sorhus