Skip to content

LogicamenteInfo/clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@logicamente.info/clone

Quickly clones a object structure

Installation

npm install --save @logicamente.info/clone
# or
yarn add @logicamente.info/clone

Usage

const clone = require('@logicamente.info/clone');
const a = { foo: { bar: 'foo' } };
const b = clone(a);
b.foo.bar = 'bar';
console.log(a);
console.log(b);

Will produce:

{ foo: { bar: 'foo' } }
{ foo: { bar: 'bar' } }

Why that clone dep?

Our algorithm is mastered to clone common objects, not containing any classes instances. That's why we rely on the original mighty https://github.com/pvorb/clone module.

For plain objects, this module is the fastest in the wild as you can witness in our tests results (Video proof). But considering class instances copying, we realized that clone is the fastest code alive.

About

Quickly clones a object structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published