Socket
Socket
Sign inDemoInstall

async-foreach

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-foreach

An optionally-asynchronous forEach with an interesting interface.


Version published
Weekly downloads
1.3M
decreased by-5.52%
Maintainers
1
Weekly downloads
 
Created

What is async-foreach?

The async-foreach package provides a way to asynchronously iterate over arrays in JavaScript, allowing for asynchronous operations within each iteration to complete before moving on to the next. It offers a simple API to work with, making it easier to handle asynchronous control flow without resorting to deeply nested callbacks.

What are async-foreach's main functionalities?

Asynchronous forEach

This feature allows you to asynchronously process items in an array. The provided code sample demonstrates how to use async-foreach to log each item in an array with a delay, ensuring each asynchronous operation completes before moving to the next.

var forEach = require('async-foreach').forEach;
var items = [1, 2, 3, 4, 5];
forEach(items, function(item, index, arr) {
  setTimeout(() => {
    console.log('Item: ' + item);
  }, item * 1000);
}, function() {
  console.log('All items have been processed.');
});

Other packages similar to async-foreach

Keywords

FAQs

Package last updated on 29 Apr 2013

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