@monstermann/fn
Version:
A utility library for TypeScript.
22 lines • 680 B
TypeScript
//#region src/string/lastIndexOfOrThrow.d.ts
/**
* `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
* ```
*/
declare const lastIndexOfOrThrow: {
(source: string): (target: string) => number;
(target: string, source: string): number;
};
//#endregion
export { lastIndexOfOrThrow };