UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

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