deeb

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i deeb

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

3.87 kB

Total Files

5

Last publish

Collaborators

  • kunieone