Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

freach

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

freach

There are so many libraries that do this sort of thing – this is just my preferred syntax. If pass an error to next, everything stops and the final callback is invoked with whatever error you passed.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

forEach

There are so many libraries that do this sort of thing – this is just my preferred syntax. If pass an error to next, everything stops and the final callback is invoked with whatever error you passed.

I like it because it's easy to switch my asynchronous code between series and parallel. It also supports iteration of lists and objects.

Series

forEach([1,2,3], function(number, next){

  // Do something, async or not
  next(err);

}, function(err){
  // Everything finished
});

Parallel


var each = forEach.parallel;

each([1,2,3], function(number, next){

  // Do something, async or not
  next(err);

}, function(err){
  // Everything done
});

Parallel with cap

This is useful for running a reasonable number of network requests in parallel.


var each = forEach.parallel(10);

each([1,2,3], function(number, next){

  // Do something, async or not
  next(err);

}, function(err){
  // Everything done
});

Keywords

FAQs

Package last updated on 15 Apr 2017

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