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

x/rimbu/common/reducer.ts>Reducer.every

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function Reducer.every
import { Reducer } from "https://deno.land/x/rimbu@0.13.0/common/reducer.ts";
const { every } = Reducer;

Returns a Reducer that ouputs true as long as all input values satisfy the given pred, false otherwise.

Examples

Example 1

console.log(Stream.range{ amount: 10 }).reduce(Reducer.every(v => v < 5))
// => false

Parameters

pred: (value: T, index: number) => boolean
  • a function taking an input value and its index, and returning true if the value satisfies the predicate

Returns

Reducer<T, boolean>