The equality for T
.
The stripped list.
import { fromString, stripPrefix, toString } from "./list.ts";
import * as Option from "./option.ts";
import { assertEquals } from "../deps.ts";
import { strict } from "./type-class/partial-eq.ts";
const stripFoo = stripPrefix(strict<string>())(fromString("foo"));
{
const optList = stripFoo(fromString("foobar"));
const optStr = Option.map(toString)(optList);
assertEquals(optStr, Option.some("bar"));
}
{
const optList = stripFoo(fromString("foo"));
const optStr = Option.map(toString)(optList);
assertEquals(optStr, Option.some(""));
}
{
const optList = stripFoo(fromString("barfoo"));
const optStr = Option.map(toString)(optList);
assertEquals(optStr, Option.none());
}
Generated using TypeDoc
Strips
list
if matchesprefix
, otherwise returnsnone
.