Last active
December 2, 2016 16:54
-
-
Save FlorianBELLAZOUZ/72cc7b9bda42d48ad98005d7e6e8f2a9 to your computer and use it in GitHub Desktop.
A quick clone deep function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cloneDeep = (obj, clone={})=>{ | |
for(var i in obj) | |
clone[i] = typeof obj[i] === "object" ? cloneDeep(obj[i], obj[i].constructor()) : obj[i]; | |
return clone; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment