replace jest with ava
This commit is contained in:
parent
27cc8b23fe
commit
0347b72305
11775 changed files with 84546 additions and 1440575 deletions
25
node_modules/array-find-index/index.js
generated
vendored
Normal file
25
node_modules/array-find-index/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
module.exports = function (arr, predicate, ctx) {
|
||||
if (typeof Array.prototype.findIndex === 'function') {
|
||||
return arr.findIndex(predicate, ctx);
|
||||
}
|
||||
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new TypeError('predicate must be a function');
|
||||
}
|
||||
|
||||
var list = Object(arr);
|
||||
var len = list.length;
|
||||
|
||||
if (len === 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (predicate.call(ctx, list[i], i, list)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue