first commit
This commit is contained in:
20
node_modules/vant/es/utils/deep-clone.mjs
generated
vendored
Normal file
20
node_modules/vant/es/utils/deep-clone.mjs
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { isDef, isObject } from "./basic.mjs";
|
||||
function deepClone(obj) {
|
||||
if (!isDef(obj)) {
|
||||
return obj;
|
||||
}
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map((item) => deepClone(item));
|
||||
}
|
||||
if (isObject(obj)) {
|
||||
const to = {};
|
||||
Object.keys(obj).forEach((key) => {
|
||||
to[key] = deepClone(obj[key]);
|
||||
});
|
||||
return to;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
export {
|
||||
deepClone
|
||||
};
|
||||
Reference in New Issue
Block a user