Revamping to matrix style
This commit is contained in:
56
node_modules/vscode-json-languageservice/lib/umd/utils/json.js
generated
vendored
Normal file
56
node_modules/vscode-json-languageservice/lib/umd/utils/json.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringifyObject = void 0;
|
||||
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);
|
||||
}
|
||||
exports.stringifyObject = stringifyObject;
|
||||
});
|
||||
Reference in New Issue
Block a user