Skip to main content
Module

x/rimbu/mod.ts>Reducer.Base

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
class Reducer.Base
implements [Reducer.Impl]<I, O, S>
import { Reducer } from "https://deno.land/x/rimbu@0.14.0/mod.ts";
const { Base } = Reducer;

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

Constructors

new
Base(
init: OptLazy<S>,
next: (
state: S,
elem: I,
index: number,
halt: () => void,
) => S
,
stateToResult: (state: S) => O,
)

Methods

collectInput<I2>(collectFun: CollectFun<I2, I>): Reducer<I2, O>
dropInput(amount: number): Reducer<I, O>
filterInput(pred: (
value: I,
index: number,
halt: () => void,
) => boolean
): Reducer<I, O>
mapInput<I2>(mapFun: (value: I2, index: number) => I): Reducer<I2, O>
mapOutput<O2>(mapFun: (value: O) => O2): Reducer<I, O2>
sliceInput(from?, amount?: number): Reducer<I, O>
takeInput(amount: number): Reducer<I, O>