@logicamente.info/clone

1.0.1 • Public • Published

@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.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @logicamente.info/clone

    Weekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    1.86 kB

    Total Files

    4

    Last publish

    Collaborators

    • natanaelsimoes