fastest-clone
Library for fastest array cloning or copy objects with similar structures
Last updated 4 years ago by ivolovikov .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fastest-clone 
SYNC missed versions from official npm registry.

Fast Array Clone Library

This library can 200X times faster than lodash (benchmark) make deep copies of an array or objects with similar structure in JavaScript

EXAMPLE

// array of SAME STRUCTURED object
var sourceArray = [{ f1 : ..., f2: ... }, ...];

You can use built-in array clone function:

var clonedArray = FastClone.cloneArray(sourceArray);

or object clone constructor factory:

// creating deep clone constructor function
var Clone = FastClone.factory(sourceArray[0]);
var clonedArray = sourceArray.map(function(item) {
    // you can add here custom logic
    return new Clone(item);
});

INSTALLATION

In a browser:

<script src="https://cdn.rawgit.com/ivolovikov/fastest-clone/master/index.js"></script>

Using npm:

npm install fastest-clone

BENCHMARK

Library Ops/sec
lodash 66,313
JQuery 62,164
FastClone 16,927,673

Benchmark source code - benchmark

LICENSE

Copyright (c) 2016 Ivan Volovikov

Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

Current Tags

  • 1.0.2                                ...           latest (4 years ago)

3 Versions

  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |