DeepClone
Light-weight deep clone implementation for JavaScript.
ℹ️ For a standalone Object type with this deep clone implementation, check out the super repository: super/object
Installation
$ npm install @clarketm/deepclone
Modules
Functions
-
DeepClone(obj, [config]) ⇒
object
⏏
Typedefs
-
Config :
object
DeepClone
object
⏏
DeepClone(obj, [config]) ⇒ 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"} }
object
Config : Kind: global typedef
Properties
Name | Type | Default |
---|---|---|
[includeNonEnumerable] | boolean |
false |