first commit
This commit is contained in:
28
app_vue/node_modules/klona/json/index.mjs
generated
vendored
Normal file
28
app_vue/node_modules/klona/json/index.mjs
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
export function klona(val) {
|
||||
var k, out, tmp;
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
out = Array(k=val.length);
|
||||
while (k--) out[k] = (tmp=val[k]) && typeof tmp === 'object' ? klona(tmp) : tmp;
|
||||
return out;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(val) === '[object Object]') {
|
||||
out = {}; // null
|
||||
for (k in val) {
|
||||
if (k === '__proto__') {
|
||||
Object.defineProperty(out, k, {
|
||||
value: klona(val[k]),
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
});
|
||||
} else {
|
||||
out[k] = (tmp=val[k]) && typeof tmp === 'object' ? klona(tmp) : tmp;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
Reference in New Issue
Block a user