-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add pMapIterable
#63
Add pMapIterable
#63
Conversation
Signed-off-by: Richie Bendall <[email protected]>
index.js
Outdated
(async () => { | ||
for (let index = 0; index < concurrency; index++) { | ||
// eslint-disable-next-line no-await-in-loop | ||
await nextItem(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if nextItem
throws? It will cause an unhandled rejection.
Bump :) |
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
What's left to do here? |
docs |
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Why do we need the separate |
Values returned by the async iterator can only be consumed one at a time. However, we can run the mapper function |
Might be a good idea to try re-implement |
👍 |
Co-authored-by: Sindre Sorhus <[email protected]>
Co-authored-by: Sindre Sorhus <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
What should happen when the mapper function returns an error? |
An error should generally make things stop as soon as possible, so I don't think it should even let the current ones finish. |
Ok I guess I'll throw out values that arrived out of order after an error. |
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
@sindresorhus I did stuff |
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Nice! Big improvement. |
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Nice work 🙏 |
Main differences from
pMap()
:stopOnError
is not available because this can now be done by the user themselvessignal
is also not available for the same reasonIf you're ok with this, I'll add docs and tests
Fixes sindresorhus/promise-fun#21