Skip to main content
Module

x/rimbu/mod.ts>AsyncReducer

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Latest
namespace AsyncReducer
Re-export
import { AsyncReducer } from "https://deno.land/x/rimbu@1.2.1/mod.ts";

Variables

Returns an AsyncReducer that remembers the first input value.

Returns an AsyncReducer that uses the valueToKey function to calculate a key for each value, and feeds the tuple of the key and the value to the collector reducer. Finally, it returns the output of the collector. If no collector is given, the default collector will return a JS multimap of the type Map<K, V[]>.

An AsyncReducer that outputs true if no input values are received, false otherwise.

Returns an AsyncReducer that remembers the last input value.

Returns a Reducer that remembers the maximum value of the numberic inputs.

Returns a Reducer that remembers the maximum value of the inputs using the given compFun to compare input values

Returns a Reducer that remembers the minimum value of the numberic inputs.

Returns a Reducer that remembers the minimum value of the inputs using the given compFun to compare input values

An AsyncReducer that outputs true if one or more input values are received, false otherwise.

Returns an AsyncReducer that splits the incoming values into two separate outputs based on the given pred predicate. Values for which the predicate is true are fed into the collectorTrue reducer, and other values are fed into the collectorFalse instance. If no collectors are provided the values are collected into arrays.

Returns an AsyncReducer instance that first applies this reducer, and then applies the given next reducer to each output produced by the previous reducer.

Returns an AsyncReducer that feeds incoming values to all reducers in the provided reducers source, and halts when the first reducer in the array is halted and returns the output of that reducer. Returns the otherwise value if no reducer is yet halted.

Returns an AsyncReducer that only produces an output value when having receives exactly one input value, otherwise will return the otherwise value or undefined.

Functions

Returns an AsyncReducer that combines multiple input reducers according to the given "shape" by providing input values to all of them and collecting the outputs in the shape.

Returns an AsyncReducer that returns true if the input values contain the given slice sequence amount times. Otherwise, returns false.

Returns an AsyncReducer with the given options:

Returns an AsyncReducer of which the input, state, and output types are the same.

Returns an AsyncReducer of which the state and output types are the same.

Returns an AsyncReducer that returns true if the last input values match the given slice values repeated amount times. Otherwise, returns false.

Returns an AsyncReducer that ouputs true when the received elements match the given other async stream source according to the eq instance, false otherwise.

Returns an AsyncReducer that ouputs true as long as all input values satisfy the given pred, false otherwise.

Returns an AsyncReducer that uses the given init and next values to fold the input values into result values.

Returns an AsyncReducer from a given Reducer or AsyncReducer instance.

Returns an AsyncReducer that ouputs false as long as no input value satisfies given pred, true otherwise.

Returns a AsyncReducer that returns true if the first input values match the given slice values repeated amount times. Otherwise, returns false.

Interfaces

The AsyncReducer implementation interface defining the required methods.

An async reducer instance that manages its own state based on the reducer definition that was used to create this instance.

Type Aliases

Convenience type to allow synchronous reducers to be supplied to functions that accept async reducers.

Type defining the result type of an async reducer combination for a given shape.

Type defining the allowed shape of async reducer combinations.

type alias AsyncReducer
Re-export
import { type AsyncReducer } from "https://deno.land/x/rimbu@1.2.1/mod.ts";

An AsyncReducer is a stand-alone asynchronous calculation that takes input values of type I, and, when requested, produces an output value of type O.

Type Parameters

I
optional
O = I
definition: AsyncReducer.Impl<I, O, unknown>

Type Parameters

I
optional
O = I
definition: AsyncReducer.Impl<I, O, unknown>