Skip to main content
Module

x/rimbu/mod.ts>Reducer.Instance

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

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

Methods

getter
halted(): boolean

Returns true if the reducer instance does not receive any more values, false otherwise.

getter
index(): number

Returns the index of the last received value.

halt(): void

Method that, when called, halts the reducer instance so that it will no longer receive values.

next(value: I): void

Sends a new value into the reducer instance.

getOutput(): O

Returns the output value based on the current given input values.