New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@axelrindle/async-for-each

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axelrindle/async-for-each

Asynchronous for/each loops with async/await

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

node-async-for-each

Asynchronous for/each loops with async/await in Node.JS

Install

$ npm i @axelrindle/async-for-each

Usage

const asyncForEach = require('@axelrindle/async-for-each');
const array = [1, 2, 3, 4, 5];

const sleep = duration => {
  return new Promise((resolve, reject) => {
    setTimeout(resolve, duration);
  });
};

// wrap in an async function to wait for the loop to finish
(async () => {
  await asyncForEach(array, async (el) => {
    console.log(`Sleeping for ${el} seconds...`);
    await sleep(el * 1000);
  });
  console.log('Done!');
})();

Credits

Credit goes to Sebastien Chopin for providing an excellent tutorial.

License

MIT

Keywords

FAQs

Package last updated on 22 Dec 2020

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