https://github.com/mingchen/node-array-foreach-async
Add forEachAsync() async/await to Array to support async functions.
https://github.com/mingchen/node-array-foreach-async
Last synced: 4 months ago
JSON representation
Add forEachAsync() async/await to Array to support async functions.
- Host: GitHub
- URL: https://github.com/mingchen/node-array-foreach-async
- Owner: mingchen
- License: mit
- Created: 2018-04-07T17:14:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-07-30T19:43:00.000Z (almost 3 years ago)
- Last Synced: 2025-08-18T11:13:24.112Z (10 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
array-foreach-async
===================
Add forEachAsync() async/await to Array to support async functions.
## Install
npm install array-foreach-async
## API
/**
* @param {function} callback function(val, idx, obj)
*/
Array.prototype.forEachAsync(callback)
## Usage
require('array-foreach-async');
await someArray.forEachAsync(async (item) => {
...
await someAsyncFunction();
...
});
## References
* [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill)
* [JavaScript: async/await with forEach()](https://codeburst.io/javascript-async-await-with-foreach-b6ba62bbf404)