[type] raf (#2699)

This commit is contained in:
neverland
2019-02-07 13:07:33 +08:00
committed by GitHub
parent cf441d9326
commit c4a9ae5fdd
11 changed files with 57 additions and 58 deletions

View 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;
}