mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 10:07:07 +00:00
[type] raf (#2699)
This commit is contained in:
11
packages/utils/deep-clone.ts
Normal file
11
packages/utils/deep-clone.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import deepAssign from './deep-assign';
|
||||
|
||||
export default function deepClone(obj: object): object {
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map(item => deepClone(item));
|
||||
}
|
||||
if (typeof obj === 'object') {
|
||||
return deepAssign({}, obj);
|
||||
}
|
||||
return obj;
|
||||
}
|
Reference in New Issue
Block a user