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

x/rimbu/common/async-reducer.ts>AsyncReducer.some

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

Returns a Reducer that ouputs false as long as no input value satisfies given pred, true otherwise.

Examples

Example 1

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

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