Files
ry.kazcloud.dev/node_modules/vscode-json-languageservice/lib/esm/utils/json.js
Ryan Kazokas d181f77fb2
All checks were successful
Build and Push / build (push) Successful in 55s
Updates dockerfile
2026-02-16 15:09:37 -05:00

43 lines
1.6 KiB
JavaScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export function stringifyObject(obj, indent, stringifyLiteral) {
if (obj !== null && typeof obj === 'object') {
var newIndent = indent + '\t';
if (Array.isArray(obj)) {
if (obj.length === 0) {
return '[]';
}
var result = '[\n';
for (var i = 0; i < obj.length; i++) {
result += newIndent + stringifyObject(obj[i], newIndent, stringifyLiteral);
if (i < obj.length - 1) {
result += ',';
}
result += '\n';
}
result += indent + ']';
return result;
}
else {
var keys = Object.keys(obj);
if (keys.length === 0) {
return '{}';
}
var result = '{\n';
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
result += newIndent + JSON.stringify(key) + ': ' + stringifyObject(obj[key], newIndent, stringifyLiteral);
if (i < keys.length - 1) {
result += ',';
}
result += '\n';
}
result += indent + '}';
return result;
}
}
return stringifyLiteral(obj);
}