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

x/fun/string.ts

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
import * as fun from "https://deno.land/x/fun@v2.0.0-alpha.10/string.ts";

Variables

The canonical implementation of Eq for string. It contains the method equals.

The canonical implementation of Monoid for string. It contains the method empty and concat.

The canonical implementation of Ord for string. It contains the methods lt, lte, equals, gte, gt, min, max, clamp, between, and compare.

The canonical implementation of Semigroup for string. It contains the method concat.

The canonical implementation of Show for string. It contains the method show.

Functions

Compare two strings and return an Ordering (-1, 0, or 1);

Combine two strings.

Returns an empty string.

Creates a Predicate over string that returns true when the string ends with the supplied searchString starting at position, if it is supplied.

Compare two strings for equality.

Creates a Predicate over string that returns true when a string includes the searchString at or beyond the optional starting position.

A Predicate for string returning true if the string is empty.

A instance of Refinement<unknown, string>. Used as a type guard to verify any type is actually a string.

Returns the length of an input string.

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

A simple curried pluralizing function. Takes the singular and plural forms of a word and returns a function that takes a count and returns the correct word for the count.

Create a function that replaces all values in a string according to a RegExp and a replacement value.

Create a substring of a string based on 0 based indices.

Split a string into an array of strings at a character or RegExp match.

Creates a Predicate over string that returns true when the string starts with the supplied searchString starting at position, if it is supplied.

Create a Predicate that returns true when it matches the supplied RegExp.

A pipeable form of String.toLowerCase.

A pipeable form of String.toUpperCase.

Trims whitespace from the beginning and end of a string.

Trims whitespace from the end of a string.

Trims whitespace from the beginning of a string.