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

x/rimbu/common/index.ts>AsyncReducer.contains

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

Returns an AsyncReducer that outputs false as long as the given elem has not been encountered in the input values, true otherwise.

Examples

Example 1

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

Parameters

elem: T
  • the element to search for
optional
eq: Eq<T> = [UNSUPPORTED]
  • (optional) a comparison function that returns true if te two given input values are considered equal