Skip to content

Instantly share code, notes, and snippets.

@shaikh-shahid
Created April 6, 2016 11:33
Show Gist options
  • Save shaikh-shahid/3cea069264f9179e021dc1943a6541d4 to your computer and use it in GitHub Desktop.
Save shaikh-shahid/3cea069264f9179e021dc1943a6541d4 to your computer and use it in GitHub Desktop.
var async = require('async');
async.waterfall([
function(callback) {
// some code to execute
// in case to go to next function provide callback like this.
callback(null,valueForNextFunction);
// Got some error ? Don't wanna go further.
// Provide true in callback and execution will stop.
//callback(true,"Some error");
},
function(parameterValue,callback) {
// Some code to execute.
callback(null,"Some data");
}
],function(err,data) {
// Code to execute after everything is done.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment