copy-deep
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

copy-deep

npm (scoped with tag) npm

Setup

  • Add copy-deep dependency using yarn or npm to your project

    With yarn:

    yarn add copy-deep

    With npm:

    npm install --save copy-deep

Usage

You can either use the function as the default import or as a partial import

default import

import copyDeep from "copy-deep"

const initial = {
  foo: "bar",
  toto: true,
  honestly: ["it", { just: "works" }],
  tata() {
    return !this.toto
  },
}

const notExtensible = Object.preventExtensions(initial)

const clone = copyDeep(notExtensible)

Partial import

import { copyDeep } from "copy-deep"

const initial = {
  foo: "bar",
  toto: true,
  honestly: ["it", { just: "works" }],
  tata() {
    return !this.toto
  },
}

const notExtensible = Object.preventExtensions(initial)

const clone = copyDeep(notExtensible)

Package Sidebar

Install

npm i copy-deep

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

12.2 kB

Total Files

16

Last publish

Collaborators

  • vinccool96