UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

23 lines (21 loc) 539 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/array/hasNone.ts /** * `hasNone(array, values)` * * Returns `true` if `array` contains none of the `values`, otherwise returns `false`. Supports iterables for the `values` parameter. * * ```ts * hasNone([1, 2, 3, 4], [5, 6, 7]); // true * ``` * * ```ts * pipe([1, 2, 3, 4], hasNone([5, 6, 7])); // true * ``` */ const hasNone = dfdlT((target, values) => { for (const value of values) if (target.includes(value)) return false; return true; }, 2); //#endregion export { hasNone };