class Base<I,O,S>
A base class that can be used to easily create AsyncReducer instances.
Type parameters
| Name | Description |
|---|---|
| I | the input value type |
| O | the output value type |
| S | the internal state type |
Properties
init
undocumented
initDefinition
readonly init: (initHalt: () => void) => MaybePromise<S>;
next
undocumented
nextDefinition
readonly next: (state: S, elem: I, index: number, halt: () => void) => MaybePromise<S>;
onClose
undocumented
onCloseDefinition
readonly onClose?: ((state: S, error?: unknown) => MaybePromise<void>) | undefined;
stateToResult
undocumented
stateToResultDefinition
readonly stateToResult: (state: S, index: number, halted: boolean) => MaybePromise<O>;
Methods
chain
undocumented
chainDefinition
chain<O2 extends O>(nextReducers: AsyncStreamSource<AsyncOptLazy<AsyncReducer.Accept<I, O2>, [O2]>>): AsyncReducer<I, O2>;
Type parameters
| Name | Constraints | Description |
|---|---|---|
| O2 | O |
Parameters
| Name | Type | Description |
|---|---|---|
nextReducers | AsyncStreamSource<AsyncOptLazy<AsyncReducer.Accept<I, O2>, [O2]>> |
collectInput
undocumented
collectInputDefinition
collectInput<I2>(collectFun: AsyncCollectFun<I2, I>): AsyncReducer<I2, O>;
Type parameters
| Name | Description |
|---|---|
| I2 |
Parameters
| Name | Type | Description |
|---|---|---|
collectFun | AsyncCollectFun<I2, I> |
compile
undocumented
compileDefinition
compile(): Promise<AsyncReducer.Instance<I, O>>;
dropInput
undocumented
dropInputfilterInput
undocumented
filterInputDefinition
filterInput(pred: (value: I, index: number, halt: () => void) => MaybePromise<boolean>, options?: {
negate?: boolean | undefined;
}): any;
Parameters
| Name | Type | Description |
|---|---|---|
pred | (value: I, index: number, halt: () => void) => MaybePromise<boolean> | |
options | {negate?: boolean | undefined;} |
flatMapInput
undocumented
flatMapInputDefinition
flatMapInput<I2>(flatMapFun: (value: I2, index: number) => MaybePromise<AsyncStreamSource<I>>): AsyncReducer<I2, O>;
Type parameters
| Name | Description |
|---|---|
| I2 |
Parameters
| Name | Type | Description |
|---|---|---|
flatMapFun | (value: I2, index: number) => MaybePromise<AsyncStreamSource<I>> |
mapInput
undocumented
mapInputDefinition
mapInput<I2>(mapFun: (value: I2, index: number) => MaybePromise<I>): AsyncReducer<I2, O>;
Type parameters
| Name | Description |
|---|---|
| I2 |
Parameters
| Name | Type | Description |
|---|---|---|
mapFun | (value: I2, index: number) => MaybePromise<I> |
mapOutput
undocumented
mapOutputDefinition
mapOutput<O2>(mapFun: (value: O, index: number, halted: boolean) => MaybePromise<O2>): AsyncReducer<I, O2>;
Type parameters
| Name | Description |
|---|---|
| O2 |
Parameters
| Name | Type | Description |
|---|---|---|
mapFun | (value: O, index: number, halted: boolean) => MaybePromise<O2> |
sliceInput
undocumented
sliceInputDefinition
sliceInput(from?: number, amount?: number): AsyncReducer<I, O>;
Parameters
| Name | Type | Description |
|---|---|---|
from | number | |
amount | number |
takeInput
undocumented
takeInputtakeOutput
undocumented
takeOutputDefinition
takeOutput(amount: number): AsyncReducer<I, O>;
Parameters
| Name | Type | Description |
|---|---|---|
amount | number |
takeOutputUntil
undocumented
takeOutputUntilDefinition
takeOutputUntil(pred: (value: O, index: number) => MaybePromise<boolean>, options?: {
negate?: boolean;
}): AsyncReducer<I, O>;
Parameters
| Name | Type | Description |
|---|---|---|
pred | (value: O, index: number) => MaybePromise<boolean> | |
options | {negate?: boolean;} |