vscode-json-languageservice 4.2.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/SECURITY.md +41 -0
  3. package/lib/esm/jsonContributions.d.ts +17 -17
  4. package/lib/esm/jsonContributions.js +1 -1
  5. package/lib/esm/jsonLanguageService.d.ts +29 -29
  6. package/lib/esm/jsonLanguageService.js +66 -66
  7. package/lib/esm/jsonLanguageTypes.d.ts +279 -278
  8. package/lib/esm/jsonLanguageTypes.js +46 -45
  9. package/lib/esm/jsonSchema.d.ts +89 -70
  10. package/lib/esm/jsonSchema.js +1 -1
  11. package/lib/esm/parser/jsonParser.js +1214 -1218
  12. package/lib/esm/services/configuration.js +528 -528
  13. package/lib/esm/services/jsonCompletion.js +918 -934
  14. package/lib/esm/services/jsonDocumentSymbols.js +267 -278
  15. package/lib/esm/services/jsonFolding.js +120 -121
  16. package/lib/esm/services/jsonHover.js +109 -112
  17. package/lib/esm/services/jsonLinks.js +72 -73
  18. package/lib/esm/services/jsonSchemaService.js +586 -605
  19. package/lib/esm/services/jsonSelectionRanges.js +61 -61
  20. package/lib/esm/services/jsonValidation.js +151 -149
  21. package/lib/esm/utils/colors.js +68 -69
  22. package/lib/esm/utils/glob.js +124 -124
  23. package/lib/esm/utils/json.js +42 -42
  24. package/lib/esm/utils/objects.js +68 -65
  25. package/lib/esm/utils/strings.js +64 -64
  26. package/lib/umd/jsonContributions.d.ts +17 -17
  27. package/lib/umd/jsonContributions.js +12 -12
  28. package/lib/umd/jsonLanguageService.d.ts +29 -29
  29. package/lib/umd/jsonLanguageService.js +90 -90
  30. package/lib/umd/jsonLanguageTypes.d.ts +279 -278
  31. package/lib/umd/jsonLanguageTypes.js +93 -92
  32. package/lib/umd/jsonSchema.d.ts +89 -70
  33. package/lib/umd/jsonSchema.js +12 -12
  34. package/lib/umd/parser/jsonParser.js +1243 -1237
  35. package/lib/umd/services/configuration.js +541 -541
  36. package/lib/umd/services/jsonCompletion.js +932 -947
  37. package/lib/umd/services/jsonDocumentSymbols.js +281 -291
  38. package/lib/umd/services/jsonFolding.js +134 -135
  39. package/lib/umd/services/jsonHover.js +123 -125
  40. package/lib/umd/services/jsonLinks.js +86 -87
  41. package/lib/umd/services/jsonSchemaService.js +602 -618
  42. package/lib/umd/services/jsonSelectionRanges.js +75 -75
  43. package/lib/umd/services/jsonValidation.js +165 -162
  44. package/lib/umd/utils/colors.js +84 -85
  45. package/lib/umd/utils/glob.js +138 -138
  46. package/lib/umd/utils/json.js +56 -56
  47. package/lib/umd/utils/objects.js +87 -83
  48. package/lib/umd/utils/strings.js +82 -82
  49. package/package.json +10 -10
@@ -1,85 +1,84 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- (function (factory) {
6
- if (typeof module === "object" && typeof module.exports === "object") {
7
- var v = factory(require, exports);
8
- if (v !== undefined) module.exports = v;
9
- }
10
- else if (typeof define === "function" && define.amd) {
11
- define(["require", "exports"], factory);
12
- }
13
- })(function (require, exports) {
14
- "use strict";
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.colorFrom256RGB = exports.colorFromHex = exports.hexDigit = void 0;
17
- var Digit0 = 48;
18
- var Digit9 = 57;
19
- var A = 65;
20
- var a = 97;
21
- var f = 102;
22
- function hexDigit(charCode) {
23
- if (charCode < Digit0) {
24
- return 0;
25
- }
26
- if (charCode <= Digit9) {
27
- return charCode - Digit0;
28
- }
29
- if (charCode < a) {
30
- charCode += (a - A);
31
- }
32
- if (charCode >= a && charCode <= f) {
33
- return charCode - a + 10;
34
- }
35
- return 0;
36
- }
37
- exports.hexDigit = hexDigit;
38
- function colorFromHex(text) {
39
- if (text[0] !== '#') {
40
- return undefined;
41
- }
42
- switch (text.length) {
43
- case 4:
44
- return {
45
- red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0,
46
- green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0,
47
- blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0,
48
- alpha: 1
49
- };
50
- case 5:
51
- return {
52
- red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0,
53
- green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0,
54
- blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0,
55
- alpha: (hexDigit(text.charCodeAt(4)) * 0x11) / 255.0,
56
- };
57
- case 7:
58
- return {
59
- red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0,
60
- green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0,
61
- blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0,
62
- alpha: 1
63
- };
64
- case 9:
65
- return {
66
- red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0,
67
- green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0,
68
- blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0,
69
- alpha: (hexDigit(text.charCodeAt(7)) * 0x10 + hexDigit(text.charCodeAt(8))) / 255.0
70
- };
71
- }
72
- return undefined;
73
- }
74
- exports.colorFromHex = colorFromHex;
75
- function colorFrom256RGB(red, green, blue, alpha) {
76
- if (alpha === void 0) { alpha = 1.0; }
77
- return {
78
- red: red / 255.0,
79
- green: green / 255.0,
80
- blue: blue / 255.0,
81
- alpha: alpha
82
- };
83
- }
84
- exports.colorFrom256RGB = colorFrom256RGB;
85
- });
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ (function (factory) {
6
+ if (typeof module === "object" && typeof module.exports === "object") {
7
+ var v = factory(require, exports);
8
+ if (v !== undefined) module.exports = v;
9
+ }
10
+ else if (typeof define === "function" && define.amd) {
11
+ define(["require", "exports"], factory);
12
+ }
13
+ })(function (require, exports) {
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.colorFrom256RGB = exports.colorFromHex = exports.hexDigit = void 0;
17
+ const Digit0 = 48;
18
+ const Digit9 = 57;
19
+ const A = 65;
20
+ const a = 97;
21
+ const f = 102;
22
+ function hexDigit(charCode) {
23
+ if (charCode < Digit0) {
24
+ return 0;
25
+ }
26
+ if (charCode <= Digit9) {
27
+ return charCode - Digit0;
28
+ }
29
+ if (charCode < a) {
30
+ charCode += (a - A);
31
+ }
32
+ if (charCode >= a && charCode <= f) {
33
+ return charCode - a + 10;
34
+ }
35
+ return 0;
36
+ }
37
+ exports.hexDigit = hexDigit;
38
+ function colorFromHex(text) {
39
+ if (text[0] !== '#') {
40
+ return undefined;
41
+ }
42
+ switch (text.length) {
43
+ case 4:
44
+ return {
45
+ red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0,
46
+ green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0,
47
+ blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0,
48
+ alpha: 1
49
+ };
50
+ case 5:
51
+ return {
52
+ red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0,
53
+ green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0,
54
+ blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0,
55
+ alpha: (hexDigit(text.charCodeAt(4)) * 0x11) / 255.0,
56
+ };
57
+ case 7:
58
+ return {
59
+ red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0,
60
+ green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0,
61
+ blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0,
62
+ alpha: 1
63
+ };
64
+ case 9:
65
+ return {
66
+ red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0,
67
+ green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0,
68
+ blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0,
69
+ alpha: (hexDigit(text.charCodeAt(7)) * 0x10 + hexDigit(text.charCodeAt(8))) / 255.0
70
+ };
71
+ }
72
+ return undefined;
73
+ }
74
+ exports.colorFromHex = colorFromHex;
75
+ function colorFrom256RGB(red, green, blue, alpha = 1.0) {
76
+ return {
77
+ red: red / 255.0,
78
+ green: green / 255.0,
79
+ blue: blue / 255.0,
80
+ alpha
81
+ };
82
+ }
83
+ exports.colorFrom256RGB = colorFrom256RGB;
84
+ });
@@ -1,138 +1,138 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createRegex = void 0;
13
- /*---------------------------------------------------------------------------------------------
14
- * Copyright (c) Microsoft Corporation. All rights reserved.
15
- * Copyright (c) 2013, Nick Fitzgerald
16
- * Licensed under the MIT License. See LICENCE.md in the project root for license information.
17
- *--------------------------------------------------------------------------------------------*/
18
- function createRegex(glob, opts) {
19
- if (typeof glob !== 'string') {
20
- throw new TypeError('Expected a string');
21
- }
22
- var str = String(glob);
23
- // The regexp we are building, as a string.
24
- var reStr = "";
25
- // Whether we are matching so called "extended" globs (like bash) and should
26
- // support single character matching, matching ranges of characters, group
27
- // matching, etc.
28
- var extended = opts ? !!opts.extended : false;
29
- // When globstar is _false_ (default), '/foo/*' is translated a regexp like
30
- // '^\/foo\/.*$' which will match any string beginning with '/foo/'
31
- // When globstar is _true_, '/foo/*' is translated to regexp like
32
- // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT
33
- // which does not have a '/' to the right of it.
34
- // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but
35
- // these will not '/foo/bar/baz', '/foo/bar/baz.txt'
36
- // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when
37
- // globstar is _false_
38
- var globstar = opts ? !!opts.globstar : false;
39
- // If we are doing extended matching, this boolean is true when we are inside
40
- // a group (eg {*.html,*.js}), and false otherwise.
41
- var inGroup = false;
42
- // RegExp flags (eg "i" ) to pass in to RegExp constructor.
43
- var flags = opts && typeof (opts.flags) === "string" ? opts.flags : "";
44
- var c;
45
- for (var i = 0, len = str.length; i < len; i++) {
46
- c = str[i];
47
- switch (c) {
48
- case "/":
49
- case "$":
50
- case "^":
51
- case "+":
52
- case ".":
53
- case "(":
54
- case ")":
55
- case "=":
56
- case "!":
57
- case "|":
58
- reStr += "\\" + c;
59
- break;
60
- case "?":
61
- if (extended) {
62
- reStr += ".";
63
- break;
64
- }
65
- case "[":
66
- case "]":
67
- if (extended) {
68
- reStr += c;
69
- break;
70
- }
71
- case "{":
72
- if (extended) {
73
- inGroup = true;
74
- reStr += "(";
75
- break;
76
- }
77
- case "}":
78
- if (extended) {
79
- inGroup = false;
80
- reStr += ")";
81
- break;
82
- }
83
- case ",":
84
- if (inGroup) {
85
- reStr += "|";
86
- break;
87
- }
88
- reStr += "\\" + c;
89
- break;
90
- case "*":
91
- // Move over all consecutive "*"'s.
92
- // Also store the previous and next characters
93
- var prevChar = str[i - 1];
94
- var starCount = 1;
95
- while (str[i + 1] === "*") {
96
- starCount++;
97
- i++;
98
- }
99
- var nextChar = str[i + 1];
100
- if (!globstar) {
101
- // globstar is disabled, so treat any number of "*" as one
102
- reStr += ".*";
103
- }
104
- else {
105
- // globstar is enabled, so determine if this is a globstar segment
106
- var isGlobstar = starCount > 1 // multiple "*"'s
107
- && (prevChar === "/" || prevChar === undefined || prevChar === '{' || prevChar === ',') // from the start of the segment
108
- && (nextChar === "/" || nextChar === undefined || nextChar === ',' || nextChar === '}'); // to the end of the segment
109
- if (isGlobstar) {
110
- if (nextChar === "/") {
111
- i++; // move over the "/"
112
- }
113
- else if (prevChar === '/' && reStr.endsWith('\\/')) {
114
- reStr = reStr.substr(0, reStr.length - 2);
115
- }
116
- // it's a globstar, so match zero or more path segments
117
- reStr += "((?:[^/]*(?:\/|$))*)";
118
- }
119
- else {
120
- // it's not a globstar, so only match one path segment
121
- reStr += "([^/]*)";
122
- }
123
- }
124
- break;
125
- default:
126
- reStr += c;
127
- }
128
- }
129
- // When regexp 'g' flag is specified don't
130
- // constrain the regular expression with ^ & $
131
- if (!flags || !~flags.indexOf('g')) {
132
- reStr = "^" + reStr + "$";
133
- }
134
- return new RegExp(reStr, flags);
135
- }
136
- exports.createRegex = createRegex;
137
- ;
138
- });
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createRegex = void 0;
13
+ /*---------------------------------------------------------------------------------------------
14
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15
+ * Copyright (c) 2013, Nick Fitzgerald
16
+ * Licensed under the MIT License. See LICENCE.md in the project root for license information.
17
+ *--------------------------------------------------------------------------------------------*/
18
+ function createRegex(glob, opts) {
19
+ if (typeof glob !== 'string') {
20
+ throw new TypeError('Expected a string');
21
+ }
22
+ const str = String(glob);
23
+ // The regexp we are building, as a string.
24
+ let reStr = "";
25
+ // Whether we are matching so called "extended" globs (like bash) and should
26
+ // support single character matching, matching ranges of characters, group
27
+ // matching, etc.
28
+ const extended = opts ? !!opts.extended : false;
29
+ // When globstar is _false_ (default), '/foo/*' is translated a regexp like
30
+ // '^\/foo\/.*$' which will match any string beginning with '/foo/'
31
+ // When globstar is _true_, '/foo/*' is translated to regexp like
32
+ // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT
33
+ // which does not have a '/' to the right of it.
34
+ // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but
35
+ // these will not '/foo/bar/baz', '/foo/bar/baz.txt'
36
+ // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when
37
+ // globstar is _false_
38
+ const globstar = opts ? !!opts.globstar : false;
39
+ // If we are doing extended matching, this boolean is true when we are inside
40
+ // a group (eg {*.html,*.js}), and false otherwise.
41
+ let inGroup = false;
42
+ // RegExp flags (eg "i" ) to pass in to RegExp constructor.
43
+ const flags = opts && typeof (opts.flags) === "string" ? opts.flags : "";
44
+ let c;
45
+ for (let i = 0, len = str.length; i < len; i++) {
46
+ c = str[i];
47
+ switch (c) {
48
+ case "/":
49
+ case "$":
50
+ case "^":
51
+ case "+":
52
+ case ".":
53
+ case "(":
54
+ case ")":
55
+ case "=":
56
+ case "!":
57
+ case "|":
58
+ reStr += "\\" + c;
59
+ break;
60
+ case "?":
61
+ if (extended) {
62
+ reStr += ".";
63
+ break;
64
+ }
65
+ case "[":
66
+ case "]":
67
+ if (extended) {
68
+ reStr += c;
69
+ break;
70
+ }
71
+ case "{":
72
+ if (extended) {
73
+ inGroup = true;
74
+ reStr += "(";
75
+ break;
76
+ }
77
+ case "}":
78
+ if (extended) {
79
+ inGroup = false;
80
+ reStr += ")";
81
+ break;
82
+ }
83
+ case ",":
84
+ if (inGroup) {
85
+ reStr += "|";
86
+ break;
87
+ }
88
+ reStr += "\\" + c;
89
+ break;
90
+ case "*":
91
+ // Move over all consecutive "*"'s.
92
+ // Also store the previous and next characters
93
+ const prevChar = str[i - 1];
94
+ let starCount = 1;
95
+ while (str[i + 1] === "*") {
96
+ starCount++;
97
+ i++;
98
+ }
99
+ const nextChar = str[i + 1];
100
+ if (!globstar) {
101
+ // globstar is disabled, so treat any number of "*" as one
102
+ reStr += ".*";
103
+ }
104
+ else {
105
+ // globstar is enabled, so determine if this is a globstar segment
106
+ const isGlobstar = starCount > 1 // multiple "*"'s
107
+ && (prevChar === "/" || prevChar === undefined || prevChar === '{' || prevChar === ',') // from the start of the segment
108
+ && (nextChar === "/" || nextChar === undefined || nextChar === ',' || nextChar === '}'); // to the end of the segment
109
+ if (isGlobstar) {
110
+ if (nextChar === "/") {
111
+ i++; // move over the "/"
112
+ }
113
+ else if (prevChar === '/' && reStr.endsWith('\\/')) {
114
+ reStr = reStr.substr(0, reStr.length - 2);
115
+ }
116
+ // it's a globstar, so match zero or more path segments
117
+ reStr += "((?:[^/]*(?:\/|$))*)";
118
+ }
119
+ else {
120
+ // it's not a globstar, so only match one path segment
121
+ reStr += "([^/]*)";
122
+ }
123
+ }
124
+ break;
125
+ default:
126
+ reStr += c;
127
+ }
128
+ }
129
+ // When regexp 'g' flag is specified don't
130
+ // constrain the regular expression with ^ & $
131
+ if (!flags || !~flags.indexOf('g')) {
132
+ reStr = "^" + reStr + "$";
133
+ }
134
+ return new RegExp(reStr, flags);
135
+ }
136
+ exports.createRegex = createRegex;
137
+ ;
138
+ });
@@ -1,56 +1,56 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- (function (factory) {
6
- if (typeof module === "object" && typeof module.exports === "object") {
7
- var v = factory(require, exports);
8
- if (v !== undefined) module.exports = v;
9
- }
10
- else if (typeof define === "function" && define.amd) {
11
- define(["require", "exports"], factory);
12
- }
13
- })(function (require, exports) {
14
- "use strict";
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.stringifyObject = void 0;
17
- function stringifyObject(obj, indent, stringifyLiteral) {
18
- if (obj !== null && typeof obj === 'object') {
19
- var newIndent = indent + '\t';
20
- if (Array.isArray(obj)) {
21
- if (obj.length === 0) {
22
- return '[]';
23
- }
24
- var result = '[\n';
25
- for (var i = 0; i < obj.length; i++) {
26
- result += newIndent + stringifyObject(obj[i], newIndent, stringifyLiteral);
27
- if (i < obj.length - 1) {
28
- result += ',';
29
- }
30
- result += '\n';
31
- }
32
- result += indent + ']';
33
- return result;
34
- }
35
- else {
36
- var keys = Object.keys(obj);
37
- if (keys.length === 0) {
38
- return '{}';
39
- }
40
- var result = '{\n';
41
- for (var i = 0; i < keys.length; i++) {
42
- var key = keys[i];
43
- result += newIndent + JSON.stringify(key) + ': ' + stringifyObject(obj[key], newIndent, stringifyLiteral);
44
- if (i < keys.length - 1) {
45
- result += ',';
46
- }
47
- result += '\n';
48
- }
49
- result += indent + '}';
50
- return result;
51
- }
52
- }
53
- return stringifyLiteral(obj);
54
- }
55
- exports.stringifyObject = stringifyObject;
56
- });
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ (function (factory) {
6
+ if (typeof module === "object" && typeof module.exports === "object") {
7
+ var v = factory(require, exports);
8
+ if (v !== undefined) module.exports = v;
9
+ }
10
+ else if (typeof define === "function" && define.amd) {
11
+ define(["require", "exports"], factory);
12
+ }
13
+ })(function (require, exports) {
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.stringifyObject = void 0;
17
+ function stringifyObject(obj, indent, stringifyLiteral) {
18
+ if (obj !== null && typeof obj === 'object') {
19
+ const newIndent = indent + '\t';
20
+ if (Array.isArray(obj)) {
21
+ if (obj.length === 0) {
22
+ return '[]';
23
+ }
24
+ let result = '[\n';
25
+ for (let i = 0; i < obj.length; i++) {
26
+ result += newIndent + stringifyObject(obj[i], newIndent, stringifyLiteral);
27
+ if (i < obj.length - 1) {
28
+ result += ',';
29
+ }
30
+ result += '\n';
31
+ }
32
+ result += indent + ']';
33
+ return result;
34
+ }
35
+ else {
36
+ const keys = Object.keys(obj);
37
+ if (keys.length === 0) {
38
+ return '{}';
39
+ }
40
+ let result = '{\n';
41
+ for (let i = 0; i < keys.length; i++) {
42
+ const key = keys[i];
43
+ result += newIndent + JSON.stringify(key) + ': ' + stringifyObject(obj[key], newIndent, stringifyLiteral);
44
+ if (i < keys.length - 1) {
45
+ result += ',';
46
+ }
47
+ result += '\n';
48
+ }
49
+ result += indent + '}';
50
+ return result;
51
+ }
52
+ }
53
+ return stringifyLiteral(obj);
54
+ }
55
+ exports.stringifyObject = stringifyObject;
56
+ });