Skip to content

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

Merged
merged 1 commit into from
Oct 1, 2018

Conversation

schmidt-sebastian
Copy link
Contributor

Revived this PR since #1256 could benefit from it.

This allows us to use SortedSet and SortedMap in the PersistencePromise utilities.

return results;
});
return PersistencePromise.forEach(all, result => {
results.push(result);
Copy link
Contributor Author

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...

Copy link
Contributor

@mikelehen mikelehen left a 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?

@mikelehen mikelehen removed their assignment Oct 1, 2018
Copy link

@gsoltis gsoltis left a 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

@schmidt-sebastian
Copy link
Contributor Author

We install polyfills for Symbol.iterator:

import 'core-js/fn/array/find';
import 'core-js/fn/array/find-index';
import 'core-js/fn/object/assign';
import 'core-js/fn/string/starts-with';
import 'core-js/fn/string/repeat';
import 'core-js/fn/symbol';
import 'core-js/fn/symbol/iterator';

@schmidt-sebastian schmidt-sebastian merged commit 5ca119a into master Oct 1, 2018
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt-foreach2 branch October 2, 2018 16:59
@firebase firebase locked and limited conversation to collaborators Oct 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants