clone
clone<
T>(value,options?):T
Defined in: packages/core/src/object/clone.ts:149
Clone a value.
By default the copy is faithful: it keeps the original’s prototype, its
symbol-keyed and non-enumerable properties, and its property attributes. Pass
recursive to copy nested values too.
Time complexity: O(1) in the size of the tree for a shallow clone, O(n) over every reachable value for a recursive one.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”T
The value to clone
options?
Section titled “options?”Clone options
Returns
Section titled “Returns”T
The cloned value
Throws
Section titled “Throws”If a value cannot be copied and unsupported is
"throw", or if the transfer list is invalid or not fully reached.