import { string } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { test } = string;
Create a Predicate that returns true when it matches the supplied RegExp. Warning, this function technically mutates RegExp, but paradoxically it does so to keep state the same. If the passed RegExp.test method is called outside of this function then mayhem will surely ensue.
Examples
Example 1
Example 1
import { test } from "./string.ts";
const words = test(/\w+/);
const result1 = words("Hello World"); // true
const result2 = words(""); // false
const result3 = words("1234"); // true