Fixed issues with deepClone, built everything

This commit is contained in:
Angelos Chalaris
2019-01-12 11:42:14 +02:00
parent 3b9ed4f2e0
commit af0f433975
16 changed files with 4816 additions and 4798 deletions

View File

@ -12,7 +12,11 @@ const deepClone = obj => {
Object.keys(clone).forEach(
key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[key])
);
return Array.isArray(obj) ? Array.from(obj) : clone;
return Array.isArray(obj) && obj.length
? (clone.length = obj.length) && Array.from(clone)
: Array.isArray(obj)
? Array.from(obj)
: clone;
};
```