astro-ghostcms/.pnpm-store/v3/files/32/e9e07f77d17a0632789b88dcea9...

11 lines
375 B
Plaintext
Raw Normal View History

2024-02-14 14:10:47 +00:00
function dset(obj, keys, val) {
keys.split && (keys=keys.split('.'));
var i=0, l=keys.length, t=obj, x, k;
while (i < l) {
k = keys[i++];
if (k === '__proto__' || k === 'constructor' || k === 'prototype') break;
t = t[k] = (i === l) ? val : (typeof(x=t[k])===typeof(keys)) ? x : (keys[i]*0 !== 0 || !!~(''+keys[i]).indexOf('.')) ? {} : [];
}
}
exports.dset = dset;