clone
Import from @varavel/vdl-plugin-sdk/utils/objects.
Creates a shallow clone of the given object.
Type Parameters
| Type Parameter | Description |
|---|---|
T |
The type of the object. |
Parameters
| Parameter | Type | Description |
|---|---|---|
obj |
T |
The object to clone. |
Returns
T
- A shallow clone of the given object.
Examples
// Clone a primitive values
const num = 29;
const clonedNum = clone(num);
console.log(clonedNum); // 29
console.log(clonedNum === num); // true