Skip to main content

class Base<I,O,S>

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

Type parameters

NameDescription
Ithe input value type
Othe output value type
Sthe internal state type

Properties

init

undocumented

Definition

readonly init: (initHalt: () => void) => MaybePromise<S>;

next

undocumented

Definition

readonly next: (state: S, elem: I, index: number, halt: () => void) => MaybePromise<S>;

onClose

undocumented

Definition

readonly onClose?: ((state: S, error?: unknown) => MaybePromise<void>) | undefined;

stateToResult

undocumented

Definition

readonly stateToResult: (state: S, index: number, halted: boolean) => MaybePromise<O>;

Methods

chain

undocumented

Definition

chain<O2 extends O>(nextReducers: AsyncStreamSource<AsyncOptLazy<AsyncReducer.Accept<I, O2>, [O2]>>): AsyncReducer<I, O2>;

Type parameters

NameConstraintsDescription
O2O

Parameters

NameTypeDescription
nextReducersAsyncStreamSource<AsyncOptLazy<AsyncReducer.Accept<I, O2>, [O2]>>

collectInput

undocumented

Definition

collectInput<I2>(collectFun: AsyncCollectFun<I2, I>): AsyncReducer<I2, O>;

Type parameters

NameDescription
I2

Parameters

NameTypeDescription
collectFunAsyncCollectFun<I2, I>

compile

undocumented

Definition

compile(): Promise<AsyncReducer.Instance<I, O>>;

dropInput

undocumented

Definition

dropInput(amount: number): AsyncReducer<I, O>;

Parameters

NameTypeDescription
amountnumber

filterInput

undocumented

Definition

filterInput(pred: (value: I, index: number, halt: () => void) => MaybePromise<boolean>, options?: {
      negate?: boolean | undefined;
    }): any;

Parameters

NameTypeDescription
pred(value: I, index: number, halt: () => void) => MaybePromise<boolean>
options{
      negate?: boolean | undefined;
    }

flatMapInput

undocumented

Definition

flatMapInput<I2>(flatMapFun: (value: I2, index: number) => MaybePromise<AsyncStreamSource<I>>): AsyncReducer<I2, O>;

Type parameters

NameDescription
I2

Parameters

NameTypeDescription
flatMapFun(value: I2, index: number) => MaybePromise<AsyncStreamSource<I>>

mapInput

undocumented

Definition

mapInput<I2>(mapFun: (value: I2, index: number) => MaybePromise<I>): AsyncReducer<I2, O>;

Type parameters

NameDescription
I2

Parameters

NameTypeDescription
mapFun(value: I2, index: number) => MaybePromise<I>

mapOutput

undocumented

Definition

mapOutput<O2>(mapFun: (value: O, index: number, halted: boolean) => MaybePromise<O2>): AsyncReducer<I, O2>;

Type parameters

NameDescription
O2

Parameters

NameTypeDescription
mapFun(value: O, index: number, halted: boolean) => MaybePromise<O2>

sliceInput

undocumented

Definition

sliceInput(from?: number, amount?: number): AsyncReducer<I, O>;

Parameters

NameTypeDescription
fromnumber
amountnumber

takeInput

undocumented

Definition

takeInput(amount: number): AsyncReducer<I, O>;

Parameters

NameTypeDescription
amountnumber

takeOutput

undocumented

Definition

takeOutput(amount: number): AsyncReducer<I, O>;

Parameters

NameTypeDescription
amountnumber

takeOutputUntil

undocumented

Definition

takeOutputUntil(pred: (value: O, index: number) => MaybePromise<boolean>, options?: {
      negate?: boolean;
    }): AsyncReducer<I, O>;

Parameters

NameTypeDescription
pred(value: O, index: number) => MaybePromise<boolean>
options{
      negate?: boolean;
    }