Last active
September 20, 2019 08:00
-
-
Save cristian-frumusanu/41468c04cb78729e7888827d6f099dd1 to your computer and use it in GitHub Desktop.
Cloning an JavaScript object (using TypeScript) see - https://stackoverflow.com/a/4591639 - for disadvantages
This file contains 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 _cloneObject = <T>( object: T ): T => { | |
return JSON.parse( JSON.stringify( object ) ); | |
} | |
export _cloneObject; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment