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

0.8.0 • Public • Published

@arnab333/deep-copy NPM version

Recursively (deep) copy JavaScript native types, like Object, Array, RegExp, Date as well as primitives.

Install

Install with npm:

$ npm install @arnab333/deep-copy

Usage

const deepCopy = require('@arnab333/deep-copy');
// OR
const { deepCopy } = require('@arnab333/deep-copy');
// OR
import { deepCopy } from '@arnab333/deep-copy';
// OR
import deepCopy from '@arnab333/deep-copy';

let obj = { a: 'b' };
let arr = [obj];
let copy = deepCopy(arr);
obj.c = 'd';

console.log(copy);
//=> [{ a: 'b' }]

console.log(arr);
//=> [{ a: 'b', c: 'd' }]

Package Sidebar

Install

npm i @arnab333/deep-copy

Weekly Downloads

0

Version

0.8.0

License

MIT

Unpacked Size

17.3 kB

Total Files

14

Last publish

Collaborators

  • arnab333