1.0.0 • Published 5 years ago

node-foreach v1.0.0

Weekly downloads
3
License
ISC
Repository
-
Last release
5 years ago

foreach

Iterate over array - control flow sync

Installation

npm install node-foreach

API

foreach(item, onRead, onComplete)

const foreach = require('node-foreach');

function onRead(item, index, next) {
    // item === 1, 2, 3
    // index === 0, 1, 2
    
    // move to next item
    next() 
}

function onComplete(err) {
    if (err) {
        console.log(err.message);
    }
}

foreach([1,2,3], onRead, onComplete);