concat<T>(...sources: (AsyncIterable<T> | Iterable<T>)[]): AsyncIterableIterator<T>
Concatenates multiple async iterables into one async iterable.
import { concat } from "./concat.ts"; async function* gen() { yield "foo"; yield "bar"; yield "baz"; yield "qux" } const iterable = concat(gen(), ["a", "b", "c", "d"]); for await (const value of iterable) console.log(value);
The above example will print the following 8 lines:
foo bar baz qux a b c d
AsyncIterableIterator<T>
An async iterable that contains elements from the iterable
sources. If any of the iterable sources is infinite,
the returned iterable is infinite.