Skip to content

Instantly share code, notes, and snippets.

@juanpaco
Created October 11, 2016 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanpaco/046c1b580bc5de1742927c2d29d655f0 to your computer and use it in GitHub Desktop.
Save juanpaco/046c1b580bc5de1742927c2d29d655f0 to your computer and use it in GitHub Desktop.
var async = require('async')
async.eachSeries(
[ 1, 2, 3 ]
, function (key, next) {
async.eachSeries(
[ 4, 5, 6 ]
, function (key, innerNext) { // note the name change
somethingAsync('something' + key, innerNext) // using the inner one
}
, function (innerErr) {
next(innerErr) // note the call to the outer one so that an inner error bubbles out
}
)
}
, function (err) {
console.log('iterating done')
}
)
var async = require('async')
function innerAsyncSeries(key, done) {
async.eachSeries(
[ 4, 5, 6 ]
, function (key, next) { // note the name change
somethingAsync('something' + key, next)
}
, function (err) {
done(err) // note the call to the outer one so that an inner error bubbles out
}
)
}
async.eachSeries(
[ 1, 2, 3 ]
, innerAsyncSeries
, function (err) {
console.log('iterating done');
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment