cloneDeep
Callable
Type parameters
- Arr: unknown[]
Parameters
x: Arr
The object to clone.
Returns Arr
A new object with the same keys and values as the original object.
The object to clone.
A new object with the same keys and values as the original object.
If the input is an array, map over it and recursively call cloneDeep on each element. If the input is an object, map over its entries and recursively call cloneDeep on each value. Otherwise, return the input.
Example
Alternatives
Use structuredClone instead https://developer.mozilla.org/en-US/docs/Web/API/structuredClone.