UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

25 lines (23 loc) 660 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/set/hasNone.ts /** * `hasNone(target, values)` * * Checks if the `target` set contains none of the specified `values` from an iterable. Returns `true` if no values exist in the set, `false` otherwise. * * ```ts * hasNone(new Set([1, 2, 3]), [4, 5]); // true * hasNone(new Set([1, 2, 3]), [3, 4]); // false * ``` * * ```ts * pipe(new Set([1, 2, 3]), hasNone([4, 5])); // true * pipe(new Set([1, 2, 3]), hasNone([3, 4])); // false * ``` */ const hasNone = dfdlT((target, values) => { for (const value of values) if (target.has(value)) return false; return true; }, 2); //#endregion export { hasNone };