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

x/fun/mod.ts>set.elem

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function set.elem
import { set } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { elem } = set;

Given an insuance of Comparable create a function that takes a value A and returns a predicate over ReadonlySet the returns true if there are any members of the set that are equal to the value.

Examples

Example 1

import * as S from "./set.ts";
import * as N from "./number.ts";
import { pipe } from "./fn.ts";

const elem = S.elem(N.ComparableNumber);

const set = S.set(1, 2, 3);

const result1 = pipe(set, elem(1)); // true
const result2 = pipe(set, elem(10)); // false

Parameters

unnamed 0: Comparable<A>

Returns

(value: A) => (ua: ReadonlySet<A>) => boolean