UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

23 lines (21 loc) 500 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/string/hasAll.ts /** * `hasAll(target, source)` * * Checks if `target` string contains all strings from the `source` iterable. * * ```ts * hasAll("hello world", ["hello", "world"]); // true * ``` * * ```ts * pipe("hello world", hasAll(["hello", "world"])); // true * ``` */ const hasAll = dfdlT((target, source) => { for (const value of source) if (!target.includes(value)) return false; return true; }, 2); //#endregion export { hasAll };