Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/mod.ts>string.test

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function string.test
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

import { test } from "./string.ts";

const words = test(/\w+/);

const result1 = words("Hello World"); // true
const result2 = words(""); // false
const result3 = words("1234"); // true

Parameters

r: RegExp