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

Async generators? #3

Closed
getify opened this issue Jul 4, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@getify
Copy link

commented Jul 4, 2019

Just wanted to see if you've considered supporting the asynchronous iteration protocol (like from async generators) with the itiriri API?

async function *getFiles(urls) {
   var prs = urls.map(fetch);
   for (let pr of prs) {
      let file = await pr;
      yield file;
   }
}

var files = itiriri( getFiles([ "url1", "url2", "url3" ]) ).take(2);

for await (let file of files) {
   console.log(file);
}
@dimadeveatii

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2019

Please see itiriri-async.

@getify

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

Thanks, that's exactly what I was looking for!

BTW, itiriri-async is a nice complement to my lib: Fasy. Fasy supports eager async iteration, whereas itiriri-async supports lazy async iteration. I had been contemplating adding lazy (iterators) support to Fasy, but now that I've found itiriri-async, I can just recommend it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.