I am using async.js for my node.js. application I need help solving the following problem.
Let's say I have the following aysnc js series function.
async.waterfall([
function getDataFromDB(request, response, callback){ ... },
function someOperationOnDBData(dbData, response, callback){ ... },
function renderSomeFlow(evaluatedData, response, callback){ ... }
]);
I have three functions called in the above order. I get data from getDataFromDBand going to someOperationOnDBDataand so on.
Suppose I need another operation between getDataFromDBand someOperationOnDBData, but still pass the DBData forward. For instance:
async.waterfall([
function getDataFromDB(request, response, callback){ ... },
function extraOperation(dbData, response, callback) {...}
function someOperationOnDBData(dbData, extraOperationData, response, callback){ ... },
function renderSomeFlow(evaluatedData, response, callback){ ... }
]);
Here, adding one step in the middle changes the definitions of the functions, and I also need to pass dbDatain extraOperationto just forward it to someOperationOnDBData. In addition, if I call another module in the middle, it may not be possible to change its parameter to send some data.
async.js ? , , . ?