rocket-connect / for-emit-of

Turn Node.js Events into Async Iterables.
https://www.npmjs.com/package/for-emit-of
MIT License
9 stars 2 forks source link

Limit yield #5

Closed Dodt closed 4 years ago

Dodt commented 4 years ago

Closes #4 To control the limit of yield, I created a new option to the function forEmitOf that receives a new parameter called limit and use this parameter for controlling the flow. I create a new flag that when the parameter is equal or higher than the limit ends up the iteration is set up as false than the while conditions is no fulfilled and ends up al the iterations and the events are closed, is important to say that when the limit value is 0 the behavior is the same as not sending the limit.

danstarns commented 4 years ago

Thanks for your PR, it's all working as intended :)