Socket
Socket
Sign inDemoInstall

neo-async

Package Overview
Dependencies
0
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    neo-async

Neo-Async is thought to be used as a drop-in replacement for Async, it almost fully covers its functionality and runs faster


Version published
Maintainers
1
Install size
481 kB
Created

Package description

What is neo-async?

The neo-async package is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. It is similar to the async package but with some performance improvements.

What are neo-async's main functionalities?

Control Flow

Execute a series of functions in sequential order. Each function is passed a callback it must call on completion.

async.series([
  function(callback) {
    // do some stuff ...
    callback(null, 'one');
  },
  function(callback) {
    // do some more stuff ...
    callback(null, 'two');
  }
],
function(err, results) {
  // results is now equal to ['one', 'two']
});

Collections

Apply a function to each item in a collection and collect the results.

async.map(['file1','file2','file3'], fs.stat, function(err, results) {
  // results is now an array of stats for each file
});

Utilities

Call a function a certain number of times and collect the results.

async.times(5, function(n, next) {
  createUser(n, function(err, user) {
    next(err, user);
  });
}, function(err, users) {
  // we should now have 5 users
});

Other packages similar to neo-async

Readme

Source

Neo-Async v1.0.0

npm Travis Codecov Dependency Status npm

Neo-Async is thought to be used as a drop-in replacement for Async, it almost fully covers its functionality and runs faster.
Async allows double callbacks in waterfall, but Neo-Async does not allow. (test)
PR is welcome ! Especially improvement for English documents :)

Neo-Async

nodei

Installation

In a browser

<script src="async.min.js"></script>

In an AMD loader

require(['async'], function(async) {});

Node.js

standard
$ npm install neo-async
var async = require('neo-async');
replacement
$ npm install neo-async
$ ln -s ./node_modules/neo-async ./node_modules/async
var async = require('async');

Bower

bower install neo-async

Feature

JSDoc

* not in Async

Collections

Control Flow

Utils

Speed Comparison

  • async v0.9.0
  • neo-async v0.6.4
  • neo-async v1.0.0

Server-side

Speed comparison of server-side measured by func-comparator.
Specifications are as follows.

  • n times trials
  • Random execution order
  • Measure the average speed[μs] of n times

sample.parllel.js

var comparator = require('func-comparator');
var _ = require('lodash');
var async = require('async');
var neo_async = require('neo-async');

var count = 100; // the number of parallel tasks
var times = 100000; // the number of trial times
var array = _.shuffle(_.times(count));
var tasks = _.map(array, function() {
    return function(next) {
        next();
    };
});

// functions will be executed by random order
var funcs = {
    'async': function(callback) {
        async.parallel(tasks, callback);
    },
    'neo-async': function(callback) {
        neo_async.parallel(tasks, callback);
    }
};

comparator
.set(funcs)
.async()
.times(times)
.start()
.result(console.log);

execute

  • 100 times trials
  • 100000 tasks

Execution environment are as follows.

  • node v0.10.38
  • node v0.12.2
  • iojs v1.8.1
$ gulp speed_test --file parallel

result

The value is the ratio (Neo-Async/Async) of the average speed per n times.

control flow
functionnode v0.10.38node v0.12.2iojs v1.8.1
parallel5.976.446.68
series6.997.827.66
parallelLimit5.564.996.15
waterfall23.3833.9936.93
times4.364.224.15
timesSeries5.054.323.72
collections
functionnode v0.10.38node v0.12.2iojs v1.8.1
each2.102.322.56
eachSeries1.041.221.23
eachLimit1.680.911.08
map3.904.034.56
mapSeries3.985.104.65
mapLimit3.602.853.44
filter3.213.123.26
filterSeries5.297.005.58
reduce2.051.962.49
reduceRight3.714.014.09
sortBy1.061.541.42
some2.632.643.03
every2.702.663.09
concat3.022.342.67
concatSeries2.562.422.65

Keywords

FAQs

Last updated on 25 Apr 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc