Light-weight deep clone implementation for JavaScript.
ℹ️ For a standalone Object type with this deep clone implementation, check out the super repository: super/object
$ npm install @clarketm/deepclone
- DeepClone(obj, [config]) ⇒
object
⏏
- Config :
object
Kind: global method of DeepClone
Returns: object
- cloned object
Param | Type | Default |
---|---|---|
obj | object |
|
[config] | Config |
{} |
Example
const clone = DeepClone({ key1: ["1", 1, true, (a, b) => a+b], [Symbol("key2")]: {s: "s"} });
console.log(clone);
// { key1: ["1", 1, true, (a, b) => a+b], Symbol("key2"): {s: "s"} }
Kind: global typedef
Properties
Name | Type | Default |
---|---|---|
[includeNonEnumerable] | boolean |
false |