MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / parseObject

Function parseObject

out/cli.cjs:28489–28513  ·  view source on GitHub ↗
(chain, val, options, valuesParsed)

Source from the content-addressed store, hash-verified

28487 return obj;
28488 };
28489 var parseObject = function(chain, val, options, valuesParsed) {
28490 var leaf = valuesParsed ? val : parseArrayValue(val, options);
28491 for (var i3 = chain.length - 1; i3 >= 0; --i3) {
28492 var obj;
28493 var root = chain[i3];
28494 if (root === "[]" && options.parseArrays) {
28495 obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : [].concat(leaf);
28496 } else {
28497 obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
28498 var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
28499 var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
28500 var index = parseInt(decodedRoot, 10);
28501 if (!options.parseArrays && decodedRoot === "") {
28502 obj = { 0: leaf };
28503 } else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) {
28504 obj = [];
28505 obj[index] = leaf;
28506 } else if (decodedRoot !== "__proto__") {
28507 obj[decodedRoot] = leaf;
28508 }
28509 }
28510 leaf = obj;
28511 }
28512 return leaf;
28513 };
28514 var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
28515 if (!givenKey) {
28516 return;

Callers 1

parseKeysFunction · 0.85

Calls 4

parseArrayValueFunction · 0.85
concatMethod · 0.80
createMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…