indexOfOr
ts
function String.indexOfOr<T>(
target: string,
source: string,
or: T,
): number | TReturns the index of the first occurrence of source string in target string, or the or value if not found.
Example
ts
import { String } from "@monstermann/string";
String.indexOfOr("hello world", "world", -1); // 6
String.indexOfOr("hello world", "foo", -1); // -1ts
import { String } from "@monstermann/string";
pipe("hello world", String.indexOfOr("world", -1)); // 6
pipe("hello world", String.indexOfOr("foo", -1)); // -1