/**
* Find the index matching a predicate
*
* @function findIndex
* @description Find the index matching a predicate
* @since v1.0.2
* @sig (a -> boolean) -> [a] -> number
* @param {Function} Predicate function returns a boolean
* @param {Array} An array like object
* @return {number}
**/
import curry from './curry'
export default curry(function findIndex (fn, a) {
let i = 0
const l = a.length
while (i < l) {
if (fn(a[i])) {
return i
}
i += 1
}
return -1
})