Often you need to pass "another" argument to a chained function, as well as the "results". How to do that?
Here's a Parse cloud code example:
var _ = require('underscore');
Parse.Cloud.define("doSomething", function(request, response)
{
var companyId = request.params.company;
blah...
companyFromCompanyId(companyId).then(function(company)
{
blah...
return employeesFromCompany(company, kount);
}).then(function(employees)
{
blah...
// here, we would like to have passed in 'company' as an argument
// as well as the "employees" result:
... company.get("name") ...
blah...
}
,
function(error) {blah...}
);
});
So, with then(function(employees)
I want to have "more arguments" coming in.
(Obviously, one could just make a variable in a bigger scope. In this question I am asking how to pass more arguments in to a .then)