deepClone: Fixed indents & failing tests

This commit is contained in:
Oscar
2018-05-11 10:23:59 +01:00
parent 76c56195b1
commit 1f7377e7d0
2 changed files with 9 additions and 7 deletions

View File

@ -3,6 +3,6 @@ let clone = Object.assign({}, obj);
Object.keys(clone).forEach(
key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[key])
);
return Array.isArray(obj) ? (clone.length = obj.length) && Array.from(clone) : obj;
return Array.isArray(obj) ? Array.from(clone) : clone;
};
module.exports = deepClone;
module.exports = deepClone;