@thi.ng/paths
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -134,3 +134,2 @@ "use strict"; | ||
const ks = toPath(path); | ||
// (s, v) => ({ ...s, [k]: f((s || {})[k], v) }); | ||
let [a, b, c, d] = ks; | ||
@@ -145,5 +144,5 @@ switch (ks.length) { | ||
case 3: | ||
return (s, v) => (Object.assign({}, s, { [a]: Object.assign({}, s[a], { [b]: Object.assign({}, s[b], { [c]: v }) }) })); | ||
return (s, v) => (Object.assign({}, s, { [a]: Object.assign({}, (s = s[a]), { [b]: Object.assign({}, s[b], { [c]: v }) }) })); | ||
case 4: | ||
return (s, v) => (Object.assign({}, s, { [a]: Object.assign({}, s[a], { [b]: Object.assign({}, s[b], { [c]: Object.assign({}, s[c], { [d]: v }) }) }) })); | ||
return (s, v) => (Object.assign({}, s, { [a]: Object.assign({}, (s = s[a]), { [b]: Object.assign({}, (s = s[b]), { [c]: Object.assign({}, s[c], { [d]: v }) }) }) })); | ||
default: | ||
@@ -150,0 +149,0 @@ const kl = ks[ks.length - 1]; |
{ | ||
"name": "@thi.ng/paths", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "immutable, optimized path-based object accessors", | ||
@@ -42,2 +42,2 @@ "main": "./index.js", | ||
} | ||
} | ||
} |
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
26146
6
380