Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/core/mod.ts>AsyncReducer.Base

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
class AsyncReducer.Base
implements [AsyncReducer.Impl]<I, O, S>
import { AsyncReducer } from "https://deno.land/x/rimbu@1.2.0/core/mod.ts";
const { Base } = AsyncReducer;

A base class that can be used to easily create AsyncReducer instances.

Constructors

new
Base(
init: (initHalt: () => void) => MaybePromise<S>,
next: (
state: S,
elem: I,
index: number,
halt: () => void,
) => MaybePromise<S>
,
stateToResult: (
state: S,
index: number,
halted: boolean,
) => MaybePromise<O>
,
onClose?: (state: S, error?: unknown) => MaybePromise<void>,
)

Methods

chain(...nextReducers: AsyncOptLazy<AsyncReducer.Accept<I, any>, [any]>[]): AsyncReducer<I, O>
collectInput<I2>(collectFun: AsyncCollectFun<I2, I>): AsyncReducer<I2, O>
dropInput(amount: number): AsyncReducer<I, O>
filterInput(pred: (
value: I,
index: number,
halt: () => void,
) => MaybePromise<boolean>
, options?: { negate?: boolean | undefined; }
): any
flatMapInput<I2>(flatMapFun: (value: I2, index: number) => MaybePromise<AsyncStreamSource<I>>): AsyncReducer<I2, O>
mapInput<I2>(mapFun: (value: I2, index: number) => MaybePromise<I>): AsyncReducer<I2, O>
mapOutput<O2>(mapFun: (value: O) => MaybePromise<O2>): AsyncReducer<I, O2>
pipe<O2>(...nextReducers: AsyncReducer.Accept<O, O2>[]): AsyncReducer<I, O2>
sliceInput(from?, amount?: number): AsyncReducer<I, O>
takeInput(amount: number): AsyncReducer<I, O>
takeOutput(amount: number): AsyncReducer<I, O>
takeOutputUntil(pred: (value: O, index: number) => MaybePromise<boolean>, options?: { negate?: boolean; }): AsyncReducer<I, O>

Constructors

new
Base(
init: (initHalt: () => void) => MaybePromise<S>,
next: (
state: S,
elem: I,
index: number,
halt: () => void,
) => MaybePromise<S>
,
stateToResult: (
state: S,
index: number,
halted: boolean,
) => MaybePromise<O>
,
onClose?: (state: S, error?: unknown) => MaybePromise<void>,
)

Methods

chain(...nextReducers: AsyncOptLazy<AsyncReducer.Accept<I, any>, [any]>[]): AsyncReducer<I, O>
collectInput<I2>(collectFun: AsyncCollectFun<I2, I>): AsyncReducer<I2, O>
dropInput(amount: number): AsyncReducer<I, O>
filterInput(pred: (
value: I,
index: number,
halt: () => void,
) => MaybePromise<boolean>
, options?: { negate?: boolean | undefined; }
): any
flatMapInput<I2>(flatMapFun: (value: I2, index: number) => MaybePromise<AsyncStreamSource<I>>): AsyncReducer<I2, O>
mapInput<I2>(mapFun: (value: I2, index: number) => MaybePromise<I>): AsyncReducer<I2, O>
mapOutput<O2>(mapFun: (value: O) => MaybePromise<O2>): AsyncReducer<I, O2>
pipe<O2>(...nextReducers: AsyncReducer.Accept<O, O2>[]): AsyncReducer<I, O2>
sliceInput(from?, amount?: number): AsyncReducer<I, O>
takeInput(amount: number): AsyncReducer<I, O>
takeOutput(amount: number): AsyncReducer<I, O>
takeOutputUntil(pred: (value: O, index: number) => MaybePromise<boolean>, options?: { negate?: boolean; }): AsyncReducer<I, O>