moderndash
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -407,22 +407,22 @@ // src/array/chunk.ts | ||
function flatKeys(obj) { | ||
const result = {}; | ||
function addToResult(prefix, value) { | ||
if (isPlainObject(value)) { | ||
const flatObj = flatKeys(value); | ||
for (const [flatKey, flatValue] of Object.entries(flatObj)) { | ||
result[`${prefix}.${flatKey}`] = flatValue; | ||
} | ||
} else if (Array.isArray(value)) { | ||
for (const [index, element] of value.entries()) { | ||
addToResult(`${prefix}[${index}]`, element); | ||
} | ||
} else { | ||
result[prefix] = value; | ||
} | ||
} | ||
const flatObject = {}; | ||
for (const [key, value] of Object.entries(obj)) { | ||
addToResult(key, value); | ||
addToResult(key, value, flatObject); | ||
} | ||
return result; | ||
return flatObject; | ||
} | ||
function addToResult(prefix, value, flatObject) { | ||
if (isPlainObject(value)) { | ||
const flatObj = flatKeys(value); | ||
for (const [flatKey, flatValue] of Object.entries(flatObj)) { | ||
flatObject[`${prefix}.${flatKey}`] = flatValue; | ||
} | ||
} else if (Array.isArray(value)) { | ||
for (const [index, element] of value.entries()) { | ||
addToResult(`${prefix}[${index}]`, element, flatObject); | ||
} | ||
} else { | ||
flatObject[prefix] = value; | ||
} | ||
} | ||
@@ -429,0 +429,0 @@ // src/object/merge.ts |
{ | ||
"name": "moderndash", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "A lodash inspired utility framework for ESM/Typescript/ESNext", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
265459