spurt

A function to iterate over items with asynchronous calls synchronously.

spurt

A function to iterate over items with asynchronous calls synchronously.

Install with npm:

npm install spurt

Example usage:

var spurt = require('spurt');
var items = [1, 2, 3];
 
spurt(items, function(itemnext) {
    // do something async, such as insert into db: 
    db.insert(item, function(errres) { // each entry 
        if (!err) {
            next();
        }
    }, function() { // all rows done 
        console.log("Inserted all the rows");
    });

Pull requests welcome

  • maybe more flexible error handling
  • optional success callback

MIT license