import { curryN } from "@unboxing/function" import { ArrPred } from '@unboxing/core' interface FindIndex { (fn: ArrPred, list: ArrayLike): number; (fn: ArrPred): (list: ArrayLike) => number; } // Returns the index of the first element of the list which matches the predicate, or `-1` if no element matches. export const findArrayIndex = curryN(2, (fn: ArrPred, arr: ArrayLike = []) => { for (let i = 0; i < arr.length; i++) { if (fn(arr[i], i, arr)) { return i; } } return -1; }) as FindIndex