RubenVerborgh / AsyncIterator

An asynchronous iterator library for advanced object pipelines in JavaScript
https://rubenverborgh.github.io/AsyncIterator/docs/
Other
49 stars 7 forks source link

Giving the option of setting the autoStart for the "from*" functions #108

Open constraintAutomaton opened 1 month ago

constraintAutomaton commented 1 month ago

Hi everyone,

I wonder if it would fit the library's design to give functions like fromArray the option to set the autoStart to a user-defined value. If this is the case, I can make a PR for it.

jeswr commented 1 month ago

The main reason not to would be due to the planned breaking changes around / removal of autostart discussed in #25, but given that they have been sitting there for such a long time (my fault), I think it is reasonable to add such options.

constraintAutomaton commented 1 month ago

Thanks for the reply! I will make a PR this week then.

rubensworks commented 1 month ago

Can't you just use the ArrayIterator constructor directly?

constraintAutomaton commented 1 month ago

I did that to fix my issue. However, I feel it should be an option with those functions because it changes the behavior quite a lot, and it can be unexpected that the iterator starts "without intervention". Of course, those functions are pretty simple, so building the iterator by oneself is not difficult. So, maybe it is unnecessary, but I think we can argue that those functions as a whole might not be necessary.