I have two functions:
function one(next){
Users.find({}, function(err, docs){
if( err)
next( err );
} else {
next( null );
}
});
}
function two(next){
Something.find({}, function(err, docs){
if( err)
next( err );
} else {
next( null );
}
});
}
I can use the async library:
async.series( [one, two], function( err ){
...
});
Here, the callback is called immediately (with err set) if one() returns err.
What's an easy, BASIC implementation of async.series?
I looked at the code for the library async
(which is fantastic), but it's a library that is meant to do a lot of stuff, and I am having real trouble following it.
Can you tell me a simple simple implementation of async.series? Something that it will simply call the functions one after the other, and -- if one of them calls the callback with an error -- is calls the final callback with err
set?
Thanks...
Merc.