Skip to main content
Module

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