Quickly clones a object structure
npm install --save @logicamente.info/clone
# or
yarn add @logicamente.info/clone
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' } }
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.