Skip to content

clarketm/DeepClone

Repository files navigation

Light-weight deep clone implementation for JavaScript.

NPM release Build Status

ℹ️ For a standalone Object type with this deep clone implementation, check out the super repository: super/object

Installation

$ npm install @clarketm/deepclone

Modules

DeepClone

Functions

DeepClone(obj, [config])object

Typedefs

Config : object

DeepClone

DeepClone(obj, [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"} }

Config : object

Kind: global typedef
Properties

Name Type Default
[includeNonEnumerable] boolean false