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 *--------------------------------------------------------------------------------------------*/
6 if (typeof module === "object" && typeof module.exports === "object") {
7 var v = factory(require, exports);
8 if (v !== undefined) module.exports = v;
10 else if (typeof define === "function" && define.amd) {
11 define(["require", "exports"], factory);
13 })(function (require, exports) {
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) {
25 for (var i = 0; i < obj.length; i++) {
26 result += newIndent + stringifyObject(obj[i], newIndent, stringifyLiteral);
27 if (i < obj.length - 1) {
32 result += indent + ']';
36 var keys = Object.keys(obj);
37 if (keys.length === 0) {
41 for (var i = 0; i < keys.length; i++) {
43 result += newIndent + JSON.stringify(key) + ': ' + stringifyObject(obj[key], newIndent, stringifyLiteral);
44 if (i < keys.length - 1) {
49 result += indent + '}';
53 return stringifyLiteral(obj);
55 exports.stringifyObject = stringifyObject;