Files
railwaysystem/RuoYi-Vue/ruoyi-ui/node_modules1/@antv/layout/es/util/object.js
T
2026-09-10 15:40:10 +08:00

25 lines
702 B
JavaScript

export const isObject = (val) => val !== null && typeof val === 'object';
export const clone = (target) => {
if (target === null) {
return target;
}
if (target instanceof Date) {
return new Date(target.getTime());
}
if (target instanceof Array) {
const cp = [];
target.forEach((v) => {
cp.push(v);
});
return cp.map((n) => clone(n));
}
if (typeof target === 'object' && Object.keys(target).length) {
const cp = Object.assign({}, target);
Object.keys(cp).forEach((k) => {
cp[k] = clone(cp[k]);
});
return cp;
}
return target;
};
//# sourceMappingURL=object.js.map