-
Notifications
You must be signed in to change notification settings - Fork 934
Allow iterables in PersistencePromise.map/forEach/waitFor #1269
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
Conversation
return results; | ||
}); | ||
return PersistencePromise.forEach(all, result => { | ||
results.push(result); |
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.
I think this should append the elements in the correct order since forEach waits for each promise one by one...
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.
Nice! I think this looks good, though I'm not 100% sure about browser compatibility of Symbol.Iterator
... It looks like IE doesn't have it. Do we have a polyfill?
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.
LGTM, pending the polyfill question from @mikelehen
We install polyfills for Symbol.iterator: import 'core-js/fn/array/find'; |
Revived this PR since #1256 could benefit from it.
This allows us to use SortedSet and SortedMap in the PersistencePromise utilities.