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

Aigle.each et al: if first argument is a Promise, resolve it before iterating over it #137

Open
adrian-gierakowski opened this issue Oct 1, 2020 · 1 comment

Comments

@adrian-gierakowski
Copy link
Contributor

It would be great if the following:

> node --eval 'require("aigle").each(Promise.resolve([1, 2]), x => console.log(x))'

had the same effect as:

> node --eval 'require("aigle").each([1, 2], x => console.log(x))'
1
2

Bluebird already behaves like this:

> node --eval 'require("bluebird").each(Promise.resolve([1, 2]), x => console.log(x))'
1
2

Btw., since Aigle.each iterates both arrays and object, we get the following wired behaviour if first arg of each is an instance of Aigle promise:

> node --eval 'require("aigle").each(require("aigle").resolve([1, 2]), x => console.log(x))'
1
[ 1, 2 ]
undefined
undefined
undefined
undefined
undefined
@suguru03
Copy link
Owner

suguru03 commented Oct 1, 2020

Thanks for the issue!
I like the idea, I will put it on the milestone. 👍

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

No branches or pull requests

2 participants