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
Example 1
console.log(Stream.range({ amount: 10 }).reduce(Reducer.contains(5)))
// => true
Parameters
elem: T
- the element to search for
- (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