import { AsyncReducer } from "https://deno.land/x/rimbu@1.2.1/stream/async/async-reducer.ts";
const { pipe } = AsyncReducer;
Returns an AsyncReducer
instance that first applies this reducer, and then applies the given next
reducer to each output produced
by the previous reducer.
Examples
Example 1
Example 1
AsyncStream
.from(Stream.of(1, 2, 3))
.reduce(
AsyncReducer.pipe(Reducer.product, Reducer.sum)
)
// => 9
type
{ <I, O1, O2>(reducer1: AsyncReducer.Accept<I, O1>, reducer2: AsyncReducer.Accept<O1, O2>): AsyncReducer<I, O2>; <I, O1, O2, O3>(): AsyncReducer<I, O3>; <I, O1, O2, O3, O4>(): AsyncReducer<I, O4>; <I, O1, O2, O3, O4, O5>(): AsyncReducer<I, O5>; }
reducer1: AsyncReducer.Accept<I, O1>,
reducer2: AsyncReducer.Accept<O1, O2>,
reducer3: AsyncReducer.Accept<O2, O3>,
reducer1: AsyncReducer.Accept<I, O1>,
reducer2: AsyncReducer.Accept<O1, O2>,
reducer3: AsyncReducer.Accept<O2, O3>,
reducer4: AsyncReducer.Accept<O2, O4>,
reducer1: AsyncReducer.Accept<I, O1>,
reducer2: AsyncReducer.Accept<O1, O2>,
reducer3: AsyncReducer.Accept<O2, O3>,
reducer4: AsyncReducer.Accept<O2, O4>,
reducer5: AsyncReducer.Accept<O2, O5>,