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

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

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

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

Examples

Example 1

console.log(Stream.range({ amount: 10 }).reduce(Reducer.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

Returns

Reducer<T, boolean>