Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support array of promises #5

Open
ajcrites opened this issue Aug 2, 2016 · 2 comments
Open

Support array of promises #5

ajcrites opened this issue Aug 2, 2016 · 2 comments

Comments

@ajcrites
Copy link
Contributor

ajcrites commented Aug 2, 2016

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.

@juliangruber
Copy link
Contributor

you can just return Promise.all([ yourArray ]) yourself, would that work?

@ajcrites
Copy link
Contributor Author

ajcrites commented Jul 9, 2017

@juliangruber yes, I'm suggesting this as an enhancement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants