I have a chain of promises some of which pass arguments down the chain, like this:
stepOne(argument).catch(errorHandler)
  .then(stepTwo).catch(errorHandler)
  .then(stepThree).catch(errorHandler)
  .then(stepFour).catch(errorHandler)
...
function stepTwo(data)
{
  // stuff
  return promise
    .then(function(data){ return Promise.resolve({arg: 'a', arg2: 'b'); }) //pass this to step three, step three does the same to four
    .catch(function(err){ return Promise.reject(err); });    
}
I'd like to be able to combine that with another argument from the calling function at the chain level, like so:
stepOne(argument).catch(errorHandler)
  .then(stepTwo).catch(errorHandler)
  .then(stepThree(dataFromTwo, extraArg)).catch(errorHandler)
  .then(stepFour(dataFromThree, extraArg, moreArg)).catch(errorHandler)
...
The goal is to reuse code and avoid duplication. However anytime I try to do that I end up with undefined values or overwriting one or the other set of parameters, how do I do this? Ideally I'd like to not have to make a superfluous promise just to merge parameters.
