node-apex
node-apex copied to clipboard
Support array of promises
If the lambda function returns an array, this module doesn't treat it as a promise and will just do cb on the pending promises. I suggest:
if (Array.isArray(v)) {
Promise.all(v).then(function (val) /* etc. */
}
We can also just wrap v in Promise.all regardless since it will work even for non-arrays. It would be slightly less efficient to do this. There is also no guarantee that there is a promise in the array.
you can just return Promise.all([ yourArray ]) yourself, would that work?
@juliangruber yes, I'm suggesting this as an enhancement