One Comment

  1. This post got me thinking, we could create a utility that’s a bit more comprehensive than the one in the article, one that will wrap regular generators and let them “act” still like async generators with the full iteration protocol (so they work with for await (..) loops, etc), but where those async generators can still be stopped immediately with a call to return(..).

    I took a stab at such a utility as a proof of concept:

    https://gist.github.com/getify/0e1b1ef7e270c6d16f4d1d616296eda4

Leave a Reply

Your email address will not be published. Required fields are marked *