UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

24 lines (22 loc) 484 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/string/test.ts /** * `test(target, source)` * * Tests if `target` string matches the `source` regular expression. * * ```ts * test("hello world", /world/); // true * test("hello world", /\d+/); // false * ``` * * ```ts * pipe("hello world", test(/world/)); // true * pipe("hello world", test(/\d+/)); // false * ``` */ const test = dfdlT((target, source) => { return source.test(target); }, 2); //#endregion export { test };