mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-23 17:39:59 +00:00
11 lines
322 B
TypeScript
11 lines
322 B
TypeScript
![]() |
/**
|
||
|
* Deep clones a reference value provided. If the value is primitive, i.e. not immutable deepClone is an
|
||
|
* identity function
|
||
|
* @template T
|
||
|
* @param {T} value
|
||
|
* @return {T}
|
||
|
*/
|
||
|
const deepClone = <T>(value: T): T => (typeof value === 'object' ? JSON.parse(JSON.stringify(value)) : value);
|
||
|
|
||
|
export default deepClone;
|