@monstermann/fn
Version:
A utility library for TypeScript.
20 lines • 462 B
TypeScript
//#region src/array/indexOf.d.ts
/**
* `indexOf(array, value)`
*
* Returns the first index at which `value` can be found in `array`, or -1 if it is not present.
*
* ```ts
* indexOf([1, 2, 3, 2, 4], 2); // 1
* ```
*
* ```ts
* pipe([1, 2, 3, 2, 4], indexOf(2)); // 1
* ```
*/
declare const indexOf: {
<T>(value: NoInfer<T>): (target: readonly T[]) => number;
<T>(target: readonly T[], value: NoInfer<T>): number;
};
//#endregion
export { indexOf };