0.3.2 • Published 3 years ago

asyncforeach-promise v0.3.2

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

asyncForEach-promise

simple async forEach method with promise support.

Installation

Installation is done using the npm install command:

$ npm install --save asyncforeach-promise

Usage

forEach(arrayOrIterableElement, callbackFunction)

Example:

const forEach = require("asyncforeach-promise");

const array = [34, 24, 54];
forEach(array, (element, index, next) => {
    console.log(element);
    next()
})
.then(() => {
    console.log("finished");
})
.catch(console.error);

Output:

34
24
54
finished

This will be super usefull if you try to interact with a database or a web API. A normal foreach would end up in multiple parallel executing tasks, ...

License

MIT

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

4 years ago

0.2.1

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago