@alwatr/deep-clone
TypeScript icon, indicating that this package has built-in type declarations

5.5.10 • Public • Published

Deep Clone

Clone deeply nested objects and arrays in JavaScript.

Installation

yarn add @alwatr/deep-clone

Usage

import {deepClone} from '@alwatr/deep-clone';

const obj1 = {
  a: 1,
  b: {
    c: 2,
    d: [3, 4, 5],
  },
};

const obj2 = deepClone(obj1);

obj2.b.c = 6;
console.log(obj1.b.c); // 2

Sponsors

The following companies, organizations, and individuals support Nanolib ongoing maintenance and development. Become a Sponsor to get your logo on our README and website.

Contributing

Contributions are welcome! Please read our contribution guidelines before submitting a pull request.

/@alwatr/deep-clone/

    Package Sidebar

    Install

    npm i @alwatr/deep-clone

    Weekly Downloads

    671

    Version

    5.5.10

    License

    MPL-2.0

    Unpacked Size

    42.1 kB

    Total Files

    10

    Last publish

    Collaborators

    • alimd