mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 03:44:48 +00:00
chore: move utils
This commit is contained in:
13
src-next/utils/deep-clone.ts
Normal file
13
src-next/utils/deep-clone.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { deepAssign } from './deep-assign';
|
||||
|
||||
export 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