merge-async-iterators
A simple async iterators merger
Requires ES2018 Async Iteration
Install
npm i merge-async-iterators
Usage
API
merge([...iterators], opts)
-
iterators
Array of async iterables -
opts
-
yieldIterator[=false]
Yields{iterator, value}
(instead ofvalue
)Useful if you wanna know which iterator yielded the value
-
-
Returns A single merged async iterable
Example
const merge = ; const array = 12;const iterable = { 3 4}const asyncIterable = { 5 6} for await const value of console
1
2 // order isn't guaranteed
undefined // finished iterators' returns will yield as well
3
4
undefined
5 // async wil almost always come after normal ones
6