3

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...
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
cyberwombat
  • 38,105
  • 35
  • 175
  • 251

2 Answers2

4

See async.apply().

async.waterfall([
  async.apply(function(req, callback) {}, req);
]);
mathieug
  • 901
  • 1
  • 11
  • 24
1
async.waterfall [
  ( (req, callback) ->

  ).bind(null, req)
]
Pickels
  • 33,902
  • 26
  • 118
  • 178