Clones an object or array.
Note: This works only for flat objects not for objects which are instances of classes.
Note: Cycles in obj are not supported for now.
obj
the type of the input object to clone
Object or array to clone.
import clone from "apprt-core/clone";const src = {x: 1, y: { a: 2 } };const copy = clone(src);src === copy // -> falsesrc.y === copy.y // -> falsecopy.y.a // -> 2 Copy
import clone from "apprt-core/clone";const src = {x: 1, y: { a: 2 } };const copy = clone(src);src === copy // -> falsesrc.y === copy.y // -> falsecopy.y.a // -> 2
Clones an object or array.