Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

passing parameters to Node.js async waterfall

I need to pass some parameters to the initial function of async waterfall(). The proposed method https://github.com/caolan/async/issues/14 does not work for me as I need to pass it the response from an ExpressJS function

exports.categories = (req, res) ->
    async.waterfall [           
       (callback) ->
         # need req here...
like image 670
cyberwombat Avatar asked Dec 27 '25 16:12

cyberwombat


1 Answers

See async.apply().

async.waterfall([
  async.apply(function(req, callback) {}, req);
]);
like image 158
mathieug Avatar answered Dec 30 '25 05:12

mathieug