Skip to content

lastIndexOfOrThrow

lastIndexOfOrThrow(target, source)

Returns the index of the last occurrence of source string in target string, or throws an error if not found.

ts
lastIndexOfOrThrow("hello world hello", "hello"); // 12
lastIndexOfOrThrow("hello world", "foo"); // throws FnError
ts
pipe("hello world hello", lastIndexOfOrThrow("hello")); // 12
pipe("hello world", lastIndexOfOrThrow("foo")); // throws FnError