produces a function that can be applied to an iterator and that will execute
the handler on each value.
The handler can be asynchronous!
By default the next will only be handled when the current handler has finished.
If you set options.concurrency to a higher value, you are allowing multiple handlers
to run in parallel.
But the next() will already be called while the (async) handler is still handling the current
result, which optimizes things by not waiting for the processing to finish, before asking for
the next one. Instead we'll first be asking for the next one, and then start processing of the
current one. This will waste less time than using 'for await (... of ...)' while still
processing things in the expected order!
produces a function that can be applied to an iterator and that will execute the handler on each value.
The handler can be asynchronous! By default the next will only be handled when the current handler has finished. If you set options.concurrency to a higher value, you are allowing multiple handlers to run in parallel. But the next() will already be called while the (async) handler is still handling the current result, which optimizes things by not waiting for the processing to finish, before asking for the next one. Instead we'll first be asking for the next one, and then start processing of the current one. This will waste less time than using 'for await (... of ...)' while still processing things in the expected order!
Returns