This commit is contained in:
Carlos Montiers A
2019-08-21 16:52:52 -04:00
committed by Angelos Chalaris
parent a26783ea6c
commit 6c00c38a61

View File

@ -20,6 +20,9 @@ const deepClone = obj => {
Object.keys(clone).forEach( Object.keys(clone).forEach(
key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[key]) key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[key])
); );
if (obj) {
Object.setPrototypeOf(clone, Object.getPrototypeOf(obj));
}
return Array.isArray(obj) && obj.length return Array.isArray(obj) && obj.length
? (clone.length = obj.length) && Array.from(clone) ? (clone.length = obj.length) && Array.from(clone)
: Array.isArray(obj) : Array.isArray(obj)