Skip to main content
Module

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