Package Exports
- fast-clone
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-clone) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme

The fastest deep cloning function on NPM that supports the following types:
- Objects
- Arrays
- Dates
- Strings
- Numbers
- Booleans
Speed Comparison
Average runtime of various NPM clone libraries on a complex object loaded from a 1.64 MB json file.
NPM Library | Time |
---|---|
clone | 716 ms |
deepcopy | 193 ms |
snapshot | 184 ms |
lodash.cloneDeep | 120 ms |
fast-clone | 60 ms |
Installation
npm install fast-clone --save
Usage
Can be used in Node.js or you can use in Browser either using Browserfy/Webpack or the global clone function.
var clone = require('fast-clone');
var a = {
name: 'Natasha Rominov',
age: 30,
skills: [
'Pistols',
'Espionage'
],
dateOfBirth: new Date('1986-05-21T00:00:00.000Z')
};
var b = clone(a);
b.skills.push('That grabby thing she does with her legs');
console.log(a.skills)
console.log(b.skills);
Output will be:
['Pistols', 'Espionage']
['Pistols', 'Espionage', 'That grabby thing she does with her legs']
Got an Issue or Feature Suggestion?
Then create an issue on GitHub and I'll fix/add it asap. :)