Skip to main content
Module

x/rimbu/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/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>; }