forked from svrjs/svrjs
Fix the deepClone function
This commit is contained in:
parent
67d9ae524c
commit
63633d1de1
1 changed files with 4 additions and 1 deletions
|
@ -20,7 +20,10 @@ function deepClone(obj) {
|
|||
_objectsArray.push(obj);
|
||||
_clonesArray.push(clone);
|
||||
obj.forEach((item, index) => {
|
||||
clone[index] = recurse(item, _objectsArray, _clonesArray);
|
||||
clone[index] =
|
||||
typeof item !== "object" || item === null
|
||||
? item
|
||||
: recurse(item, _objectsArray, _clonesArray);
|
||||
});
|
||||
} else {
|
||||
clone = {};
|
||||
|
|
Reference in a new issue