Socket
Socket
Sign inDemoInstall

forEachAsync

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forEachAsync

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


Version published
Weekly downloads
4.5K
decreased by-13.18%
Maintainers
1
Weekly downloads
 
Created
Source

forEachAsync v3.x

New Version in a new repo - FuturesJS/forEachAsync

v3.x (aka 'Diet Cola") has all of the awesomeness of forEachAsync v2.x, but trims the fat and comes browser-ready!

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.

Keywords

FAQs

Package last updated on 13 Jan 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc