koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
23 lines (22 loc) • 697 B
JavaScript
"use client";
const c = (r, e, i) => (Object(r) !== r || (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce(
(n, s, t) => (
// @ts-expect-error TODO: improve types
Object(n[s]) === n[s] ? (
// Yes: then follow that path
// @ts-expect-error TODO: improve types
n[s]
) : (
// No: create the key. Is the next key a potential array-index?
// @ts-expect-error TODO: improve types
n[s] = // @ts-expect-error TODO: improve types
Math.abs(e[t + 1]) >> 0 === +e[t + 1] ? [] : {}
)
),
// No: assign a new plain object
r
)[e[e.length - 1]] = i), r);
export {
c as set
};
//# sourceMappingURL=set.js.map