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

x/rimbu/core/mod.ts>Reducer.single

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

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

type

{ <T>(): Reducer<T, T | undefined>; <T, O>(otherwise: OptLazy<O>): Reducer<T, T | O>; }