- Complete React app with 7 developer tools - JSON Tool with visual structured editor - Serialize Tool with visual structured editor - URL, Base64, CSV/JSON, Beautifier, Diff tools - Responsive navigation with dropdown menu - Dark/light mode toggle - Mobile-responsive design with sticky header - All tools working with copy/paste functionality
30 lines
621 B
JavaScript
30 lines
621 B
JavaScript
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;
|
|
}
|
|
|
|
exports.klona = klona; |