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

x/rimbu/common/reducer.ts

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
import * as rimbu from "https://deno.land/x/rimbu@1.0.3/common/reducer.ts";

Classes

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

Variables

Returns a Reducer that takes boolean values and outputs true if all input values are true, and false otherwise.

A Reducer that calculates the average of all given numberic input values.

Returns a Reducer that remembers the amount of input items provided.

Returns a Reducer that remembers the first input value.

Returns a Reducer that remembers the first input value for which the given pred function returns true.

Returns a Reducer that outputs true if no input values are received, false otherwise.

Returns a Reducer that remembers the last input value.

Returns a Reducer that remembers the last input value for which the given pred function returns true.

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

Returns a Reducer that outputs true if one or more input values are received, false otherwise.

Returns a Reducer that takes boolean values and outputs true if one or more input values are true, and false otherwise.

A Reducer that calculates the product of all given numeric input values.

A Reducer that sums all given numeric input values.

Functions

Returns a Reducer that combines multiple input reducers by providing input values to all of them and collecting the outputs in an array.

Returns a Reducer that combines multiple input reducers by providing input values to all of them and collecting the outputs in the shape of the given object.

Returns a Reducer that outputs false as long as the given elem has not been encountered in the input values, true otherwise.

Returns a Reducer with the given options:

Returns a Reducer of which the input, state, and output types are the same.

Returns a Reducer of which the state and output types are the same.

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

Returns a Reducer that joins the given input values into a string using the given options.

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

Returns a Reducer that collects received input values in an array, and returns a copy of that array as an output value when requested.

Returns a Reducer that collects received input tuples into a mutable JS Map, and returns a copy of that map when output is requested.

Returns a Reducer that collects 2-tuples containing keys and values into a plain JS object, and returns a copy of that object when output is requested.

Returns a Reducer that collects received input values into a mutable JS Set, and returns a copy of that map when output is requested.

Interfaces

The Implementation interface for a Reducer, which also exposes the internal state type.

Type Aliases

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