Used to do deep copy of objects and arrays (among others)
npm install copy-deep


- Add copy-deep dependency using yarn or npm to your project
With yarn:
``sh`
yarn add copy-deep
With npm:
`sh`
npm install --save copy-deep
You can either use the function as the default import or as a partial import
`ts
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)
`
`ts
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)
``