@cocreate/utils
Advanced tools
Comparing version 1.37.2 to 1.37.3
{ | ||
"name": "@cocreate/utils", | ||
"version": "1.37.2", | ||
"version": "1.37.3", | ||
"description": "A simple utils component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -293,3 +293,6 @@ (function (root, factory) { | ||
let oldObject = new Object(newObject); | ||
let keys = key.replace(/\[(\d+)\]/g, ".$1").split("."); | ||
let keys = key | ||
.replace(/\[(\d+)\]/g, ".$1") | ||
.split(".") | ||
.map((k) => (isNaN(k) ? k : Number(k))); | ||
let value = data[key]; | ||
@@ -301,3 +304,3 @@ let operator; | ||
for (let i = 0; i < keys.length; i++) { | ||
if (/^\d+$/.test(keys[i])) keys[i] = parseInt(keys[i]); | ||
// if (/^\d+$/.test(keys[i])) keys[i] = parseInt(keys[i]); | ||
@@ -416,8 +419,18 @@ if (length == i) { | ||
else delete newObject[keys[i]]; | ||
} else newObject[keys[i]] = value; | ||
} else if (typeof keys[i] === "number") { | ||
newObject.splice(keys[i], 0, value); | ||
} else { | ||
newObject[keys[i]] = value; | ||
} | ||
} else if ( | ||
typeof keys[i + 1] === "number" && | ||
!Array.isArray(newObject[keys[i]]) | ||
) { | ||
newObject[keys[i]] = []; | ||
} else { | ||
newObject[keys[i]] = oldObject[keys[i]] || {}; | ||
newObject = newObject[keys[i]]; | ||
oldObject = oldObject[keys[i]]; | ||
newObject[keys[i]] = newObject[keys[i]] || {}; | ||
// newObject[keys[i]] = oldObject[keys[i]] || {}; | ||
// oldObject = oldObject[keys[i]]; | ||
} | ||
newObject = newObject[keys[i]]; | ||
} | ||
@@ -424,0 +437,0 @@ } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
176828
1187