@monstermann/fn
Version:
A utility library for TypeScript.
22 lines (20 loc) • 430 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
//#region src/string/indexOf.ts
/**
* `indexOf(target, source)`
*
* Returns the index of the first occurrence of `source` string in `target` string, or -1 if not found.
*
* ```ts
* indexOf("hello world", "world"); // 6
* ```
*
* ```ts
* pipe("hello world", indexOf("world")); // 6
* ```
*/
const indexOf = dfdlT((a, b) => {
return a.indexOf(b);
}, 2);
//#endregion
export { indexOf };