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
init
Definition
readonly init: (initHalt: () => void) =>
MaybePromise
<S>;
next
undocumented
next
Definition
readonly next: (state: S, elem: I, index: number, halt: () => void) =>
MaybePromise
<S>;
onClose
undocumented
onClose
Definition
readonly onClose?: ((state: S, error?: unknown) =>
MaybePromise
<void>)
|
undefined;
stateToResult
undocumented
stateToResult
Definition
readonly stateToResult: (state: S, index: number, halted: boolean) =>
MaybePromise
<O>;
Methods
chain
undocumented
chain
Definition
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
collectInput
Definition
collectInput<I2>(collectFun:
AsyncCollectFun
<I2, I>):
AsyncReducer
<I2, O>;
Type parameters
Name | Description |
---|---|
I2 |
Parameters
Name | Type | Description |
---|---|---|
collectFun | AsyncCollectFun <I2, I> |
compile
undocumented
compile
Definition
compile(): Promise<
AsyncReducer.Instance
<I, O>>;
dropInput
undocumented
dropInput
filterInput
undocumented
filterInput
Definition
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
flatMapInput
Definition
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
mapInput
Definition
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
mapOutput
Definition
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
sliceInput
Definition
sliceInput(from?: number, amount?: number):
AsyncReducer
<I, O>;
Parameters
Name | Type | Description |
---|---|---|
from | number | |
amount | number |
takeInput
undocumented
takeInput
takeOutput
undocumented
takeOutput
Definition
takeOutput(amount: number):
AsyncReducer
<I, O>;
Parameters
Name | Type | Description |
---|---|---|
amount | number |
takeOutputUntil
undocumented
takeOutputUntil
Definition
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; } |