2 module.exports = function (arr, predicate, ctx) {
3 if (typeof Array.prototype.findIndex === 'function') {
4 return arr.findIndex(predicate, ctx);
7 if (typeof predicate !== 'function') {
8 throw new TypeError('predicate must be a function');
11 var list = Object(arr);
12 var len = list.length;
18 for (var i = 0; i < len; i++) {
19 if (predicate.call(ctx, list[i], i, list)) {