Aigle.each et al: if first argument is a Promise, resolve it before iterating over it
adrian-gierakowski opened this issue · 1 comments
adrian-gierakowski commented
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 commented
Thanks for the issue!
I like the idea, I will put it on the milestone. 👍