fromIterable<T>(source: AsyncIterable<T> | Iterable<T>): AsyncIterableIterator<T>
Turns a synchrnous iterable source into an async iterable.
import { fromIterable } from "./collections.ts"; function* iterable() { yield 1; yield 2; yield 3; } const asyncIterable = fromIterable(iterable()); for await (const value of asyncIterable) console.log(value);
The above example will print the following lines:
1 2 3
AsyncIterableIterator<T>
An async iterable that yields the same elements as the source
iterable.