https://github.com/jdormit/async-for-each
Asynchronous array iteration
https://github.com/jdormit/async-for-each
Last synced: 12 months ago
JSON representation
Asynchronous array iteration
- Host: GitHub
- URL: https://github.com/jdormit/async-for-each
- Owner: jdormit
- License: mit
- Created: 2017-01-30T16:36:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-30T17:58:44.000Z (over 9 years ago)
- Last Synced: 2025-05-21T17:18:58.450Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme-base.md
- License: LICENSE
Awesome Lists containing this project
README
# async-for-each
## Asynchronous array iteration
`async-for-each` exposes a function to iterate over an array asynchronously. This is useful
for iteration that must occur in an asynchronous context, or for iterating over long arrays
without blocking the event loop.
# Installation
npm install --save async-for-each
# Usage
```javascript
const asyncForEach = require("async-for-each");
const arr = [1, 2, 3, 4, 5];
asyncForEach(arr, function(value, index, next) {
console.log("The value at %s is %s", index, value);
doSomethingAsyncWithValue(value, function() {
next();
});
}, function() {
console.log("Iteration complete!");
});
```
# API
#include "docs.md"