Skip to main content
Module

x/rimbu/mod.ts>AsyncReducer.every

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

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

Examples

Example 1

await AsyncStream.from(Stream.range{ amount: 10 })).reduce(AsyncReducer.every(async v => v < 5))
// => false

Parameters

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