UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

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