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

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

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

Returns a Reducer that remembers the last input value.

Examples

Example 1

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

type

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