UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

22 lines (20 loc) 471 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/string/lastIndexOf.ts /** * `lastIndexOf(target, source)` * * Returns the index of the last occurrence of `source` string in `target` string, or -1 if not found. * * ```ts * lastIndexOf("hello world hello", "hello"); // 12 * ``` * * ```ts * pipe("hello world hello", lastIndexOf("hello")); // 12 * ``` */ const lastIndexOf = dfdlT((a, b) => { return a.lastIndexOf(b); }, 2); //#endregion export { lastIndexOf };