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

x/fun/mod.ts>set.every

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function set.every
import { set } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { every } = set;

Operates like Array.every, testing values in a ReadonlySet with a Predicate until either the predicate returns false for a value or all of the values have been tested as true. Shortcircuits on the first value that returns false. This is the dual of some.

Examples

Example 1

import * as S from "./set.ts";

const some = S.some((n: number) => n > 0);

const result1 = some(S.set(1, 2, 3)); // true
const result2 = some(S.set(0)); // false
const result3 = some(S.empty()); // false
const result4 = some(S.set(-1, -2, -3, 1)); // true

Parameters

predicate: Predicate<A>

Returns

(ua: ReadonlySet<A>) => boolean