1.0.0 • Published 1 year ago

deeb v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

deeb

A utility library that provides a deep copy function for JavaScript objects.

Installation

Using npm:

npm install deeb

Using yarn:

yarn add deeb

Usage

Import the deepCopy function and use it to create deep copies of your objects:

import deepCopy from "deeb";

const original = {
  a: 1,
  b: [2, 3],
  c: {
    d: 4,
  },
  e: new Map([["f", 5]]),
  g: new Set([6, 7]),
};

const copied = deepCopy(original);

console.log(copied); // Output: { a: 1, b: [ 2, 3 ], c: { d: 4 }, e: Map(1) { 'f' => 5 }, g: Set(2) { 6, 7 } }
console.log(copied === original); // Output: false
console.log(copied.b === original.b); // Output: false
console.log(copied.c === original.c); // Output: false
console.log(copied.e === original.e); // Output: false
console.log(copied.g === original.g); // Output: false

License

MIT

1.0.0

1 year ago