Skip to content

Instantly share code, notes, and snippets.

@cristian-frumusanu
Last active September 20, 2019 08:00
Show Gist options
  • Save cristian-frumusanu/41468c04cb78729e7888827d6f099dd1 to your computer and use it in GitHub Desktop.
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
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