Skip to main content
Module

x/fun/string.ts>match

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

Create a function that returns an Option. This is a curried form of RegExp.match.

Examples

Example 1

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

const words = match(/\w+/g);

const result1 = words("Hello World"); // Some(["Hello", "World"])
const result2 = words(""); // None
const result3 = words("1234"); // Some(["1234"])

Parameters

regex: RegExp