.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rc / node_modules / strip-json-comments / readme.md
1 # strip-json-comments [![Build Status](https://travis-ci.org/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-json-comments)
2
3 > Strip comments from JSON. Lets you use comments in your JSON files!
4
5 This is now possible:
6
7 ```js
8 {
9         // rainbows
10         "unicorn": /* ❤ */ "cake"
11 }
12 ```
13
14 It will replace single-line comments `//` and multi-line comments `/**/` with whitespace. This allows JSON error positions to remain as close as possible to the original source.
15
16 Also available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin.
17
18
19 ## Install
20
21 ```
22 $ npm install --save strip-json-comments
23 ```
24
25
26 ## Usage
27
28 ```js
29 const json = '{/*rainbows*/"unicorn":"cake"}';
30
31 JSON.parse(stripJsonComments(json));
32 //=> {unicorn: 'cake'}
33 ```
34
35
36 ## API
37
38 ### stripJsonComments(input, [options])
39
40 #### input
41
42 Type: `string`
43
44 Accepts a string with JSON and returns a string without comments.
45
46 #### options
47
48 ##### whitespace
49
50 Type: `boolean`  
51 Default: `true`
52
53 Replace comments with whitespace instead of stripping them entirely.
54
55
56 ## Related
57
58 - [strip-json-comments-cli](https://github.com/sindresorhus/strip-json-comments-cli) - CLI for this module
59 - [strip-css-comments](https://github.com/sindresorhus/strip-css-comments) - Strip comments from CSS
60
61
62 ## License
63
64 MIT © [Sindre Sorhus](http://sindresorhus.com)