
Research
/Security News
Fake imToken Chrome Extension Steals Seed Phrases via Phishing Redirects
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.
async-for-each
Advanced tools
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.
npm install --save async-for-each
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!");
});
Iterates over an array asynchronously.
functionThe asyncForEach iterator callback.
functionThe asyncForEach final callback.
Iterates over an array asynchronously.
Kind: global function
| Param | Type | Description |
|---|---|---|
| array | Array | The array over which to iterate. |
| iterator | iteratorCallback | The iterator function. Called with the signature iterator(value, index, next), where value is the current array value, index is the current index, and next is a function to be called when the next iteration should occur. IMPORTANT: if next() is never called in the iterator function, the iteration will never complete. |
| callback | finalCallback | The callback function. Called with the signature callback(error) when the iteration is complete. |
functionThe asyncForEach iterator callback.
Kind: global typedef
| Param | Type | Description |
|---|---|---|
| value | * | The value currently being iterated over. |
| index | number | The index currently being iterated over |
| next | function | Called to indicate that the current iteration is over. |
functionThe asyncForEach final callback.
Kind: global typedef
| Param | Type | Description |
|---|---|---|
| error | Error | Error that was raised during iteration, if any. |
FAQs
Asynchronous array iteration
The npm package async-for-each receives a total of 28 weekly downloads. As such, async-for-each popularity was classified as not popular.
We found that async-for-each demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Research
/Security News
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.