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

x/rimbu/core/mod.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.2.0/core/mod.ts";
const { contains } = Reducer;

Returns a Reducer that outputs false as long as the given elem has not been encountered the given amount of times 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
options: { amount?: number; eq?: Eq<T>; negate?: boolean; } = [UNSUPPORTED]
  • (optional) an object containing the following properties:
  • amount: (detaulf: 1) the amount of elements to find
  • eq: (default: Eq.objectIs) the Eq instance to use to compare elements
  • negate: (default: false) when true will invert the given predicate

Returns

Reducer<T, boolean>