Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fun/string.ts>test

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function test
import { test } from "https://deno.land/x/fun@v2.0.0/string.ts";

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