Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/rimbu/core/main/index.ts>Reducer.Base

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

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

Constructors

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

Methods

chain<O2 extends O>(nextReducers: StreamSource<OptLazy<Reducer<I, O2>, [O2]>>): Reducer<I, O2>
collectInput<I2>(collectFun: CollectFun<I2, I>): Reducer<I2, O>
dropInput(amount: number): Reducer<I, O>
filterInput(pred: (
value: I,
index: number,
halt: () => void,
) => boolean
, options?: { negate?: boolean | undefined; }
): any
flatMapInput<I2>(flatMapFun: (value: I2, index: number) => StreamSource<I>): Reducer<I2, O>
mapInput<I2>(mapFun: (value: I2, index: number) => I): Reducer<I2, O>
mapOutput<O2>(mapFun: (
value: O,
index: number,
halted: boolean,
) => O2
): Reducer<I, O2>
sliceInput(from?, amount?: number): Reducer<I, O>
takeInput(amount: number): Reducer<I, O>
takeOutput(amount: number): Reducer<I, O>
takeOutputUntil(pred: (value: O, index: number) => boolean, options?: { negate?: boolean; }): Reducer<I, O>