source: imaps-frontend/node_modules/strip-json-comments/index.d.ts@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 807 bytes
RevLine 
[d565449]1declare namespace stripJsonComments {
2 interface Options {
3 /**
4 Replace comments with whitespace instead of stripping them entirely.
5
6 @default true
7 */
8 readonly whitespace?: boolean;
9 }
10}
11
12/**
13Strip comments from JSON. Lets you use comments in your JSON files!
14
15It 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.
16
17@param jsonString - Accepts a string with JSON.
18@returns A JSON string without comments.
19
20@example
21```
22const json = `{
23 // Rainbows
24 "unicorn": "cake"
25}`;
26
27JSON.parse(stripJsonComments(json));
28//=> {unicorn: 'cake'}
29```
30*/
31declare function stripJsonComments(
32 jsonString: string,
33 options?: stripJsonComments.Options
34): string;
35
36export = stripJsonComments;
Note: See TracBrowser for help on using the repository browser.