I have two asynchronous calls, I want to (kind of) merge the response from call 1 with the response from call 2 in an object.
The code below does this/works. My question: Is there a way to make the callback params from Promise.all
a bit more readable? I don't really like to use an array in this case.
function getOptions() {
let programRequest = someAsynFunc(...);
let overviewTypeRequest = someOtherAsynFunc(...);
return Promise.all([programRequest, overviewTypeRequest]).then(values => {
return {
programs: values[0],
overviewTypes: values[1]
}
});
}