Fix issue #1008
This commit is contained in:
committed by
Angelos Chalaris
parent
c913e38cf6
commit
a26783ea6c
@ -11,6 +11,11 @@ Use `Object.keys()` and `Array.prototype.forEach()` to determine which key-value
|
||||
|
||||
```js
|
||||
const deepClone = obj => {
|
||||
let type = typeof obj;
|
||||
let isAssignable = type === "function" || type === "object" && !!obj;
|
||||
if (!isAssignable) {
|
||||
return obj;
|
||||
}
|
||||
let clone = Object.assign({}, obj);
|
||||
Object.keys(clone).forEach(
|
||||
key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[key])
|
||||
|
||||
Reference in New Issue
Block a user