UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

22 lines (20 loc) 430 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/array/indexOf.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 * ``` */ const indexOf = dfdlT((target, value) => { return target.indexOf(value); }, 2); //#endregion export { indexOf };