GithubHelp home page GithubHelp logo

fast-clone's Introduction

fast-clone's People

Contributors

codeandcats avatar greenkeeper[bot] avatar tomsawkins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fast-clone's Issues

Add typings

It's 2018 and this library doesn't have typings!

Would be nice to rewrite in TypeScript and just publish the generated .js and .d.ts files.

Ability to exclude specific properties

So you could for example, exclude all the properties starting with $ from being cloned.

Angular likes to attach extra '$...' properties to scoped objects, and although there exists angular.copy for cloning objects without the $ props, fast-clone is faster and can be used both on server and client. So would be handy to have.

Benchmark inaccurate

To run the benchmarks I had to lock jsdom to npm install -D [email protected] because benv doesn't specify a version range, and the new jsdom has deprecated methods that were being used by benv.

Anyways, the benchmarks consistently showed rfdc as the fastest approach.

λ ~/Projects/fast-clone/ master* npm run benchmark

> [email protected] benchmark /Users/jack/Projects/fast-clone
> ts-node --files ./support/benchmark

Generating random json data...
Done.

Test data size is:  7.15 MB

Running benchmark 1 of 7... Done
Running benchmark 2 of 7... Done
Running benchmark 3 of 7... Done
Running benchmark 4 of 7... Done
Running benchmark 5 of 7... Done
Running benchmark 6 of 7... Done
Running benchmark 7 of 7... Done

Library          | Time
-----------------|---------
clone            | 2,181 ms
angular.copy     | 1,715 ms
snapshot         | 1,182 ms
lodash.cloneDeep |   197 ms
fast-clone       |   149 ms
deepClone        |   139 ms
rfdc             |    35 ms

Add support for circular structures

This library does not support circular references, but if we could still get the same performance while supporting them it would be great! An alternative would be to add an option to enable it, so that existing users won't be affected and still get the same super-fast cloning.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.