Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  ..
  src
  index.js
  package.json
  rollup.config.js
  LICENSE
  .eslintrc.js
  README.md
  .size-limit
  .travis.yml
Size: Mime:

nanoclone

license npm
Only 300B to deep clone JavaScript objects

Is it small enough?

See the size of the most popular clone npm package with 250M+ downloads image
And nanoclone size:
image

Supported

  • Primitives
  • Arrays
  • Plain objects
  • DOM Nodes
  • Date instances
  • RegExp instances
  • Maps
  • Sets
  • Circular structures

Installation

yarn add nanoclone
npm install nanoclone

Usage

import clone from 'nanoclone'

let a = {
  num: 2,
  arr: [1, 2, 3],
  nested: {
    obj: {
      a: 0
    }
  }
}

let b = clone(a)

License

MIT