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

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

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

Returns a Reducer that remembers the first input value.

Examples

Example 1

console.log(Stream.range{ amount: 10 }).reduce(Reducer.first())
// => 0

type

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