@monstermann/fn
Version:
A utility library for TypeScript.
22 lines • 663 B
TypeScript
//#region src/string/lastIndexOfOr.d.ts
/**
* `lastIndexOfOr(target, source, or)`
*
* Returns the index of the last occurrence of `source` string in `target` string, or the `or` value if not found.
*
* ```ts
* lastIndexOfOr("hello world hello", "hello", -1); // 12
* lastIndexOfOr("hello world", "foo", -1); // -1
* ```
*
* ```ts
* pipe("hello world hello", lastIndexOfOr("hello", -1)); // 12
* pipe("hello world", lastIndexOfOr("foo", -1)); // -1
* ```
*/
declare const lastIndexOfOr: {
<T>(source: string, or: T): (target: string) => number | T;
<T>(target: string, source: string, or: T): number | T;
};
//#endregion
export { lastIndexOfOr };