forEachAsync

The forEachAsync module of FuturesJS (Ender.JS and Node.JS)

Please use 'foreachasync' instead. See https://www.npmjs.com/package/foreachasync
Last updated 14 years ago by coolaj86 .
Repository · Original npm · Tarball · package.json
$ npm install forEachAsync 
SYNC missed versions from official npm registry.

Array.forEachAsync()

Another reincarnation of sequence that makes sense for the use case of arrays.

Example:

var forEachAsync = require('forEachAsync')
  , count = 0
  , timers = [
      101,
      502,
      203,
      604,
      105
    ];

function hello(next, time) {
  this[count] = time;

  if (count >= 4) {
    next(forEachAsync.BREAK);
  }

  console.log(count += 1, time);

  setTimeout(next, time);
}

function goodbye() {
  console.log("All Done", this);
}

forEachAsync(timers, hello, {}).then(goodbye);

API

  • forEachAsync(array, callback*[, thisArg]*)
  • forEachAsync#then(finalCallback)
  • forEachAsync#BREAK

Warning: Poorly written code may have really strange errors when Array.prototype is extended. If you run into such problems please contact the author of the code (I'm also willing to help if they are unavailable). Libraries such as jQuery or MooTools will accept bug reports for such failures.

Current Tags

  • 3.0.0-rc1                                ...           beta (13 years ago)
  • 3.0.0                                ...           latest (13 years ago)

5 Versions

  • 3.0.0 [deprecated]           ...           13 years ago
  • 2.2.1 [deprecated]           ...           13 years ago
  • 3.0.0-rc1                                ...           13 years ago
  • 2.2.0 [deprecated]           ...           14 years ago
  • 2.1.1 [deprecated]           ...           15 years ago
Maintainers (1)
Downloads
Total 16
Today 0
This Week 0
This Month 8
Last Day 0
Last Week 2
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE