method StreamClass.through
Private
StreamClass.through<S, U>(
source: Source<S>,
fn: (elements: AsyncIterable<S>) => Source<U>
): StreamClass<Exclude<U, AnyFailure>, Extract<U, AnyFailure>>

StreamClass#through as a static: Stream.through(source, …) is Stream.from(source).through(…).

await Stream.through([1, 2], async function* (els) { yield* els; }).collect(); // [1, 2]

Type Parameters

Parameters

source: Source<S>
fn: (elements: AsyncIterable<S>) => Source<U>

Return Type

StreamClass<Exclude<U, AnyFailure>, Extract<U, AnyFailure>>

Usage

import { StreamClass } from "lib/stream/stream.ts";