From abd94a7f5a50f43c797a11b53549ae48fff667c3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 10 Oct 2016 03:43:44 +0200 Subject: add node_modules to address #4364 --- node_modules/array-find-index/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 node_modules/array-find-index/index.js (limited to 'node_modules/array-find-index/index.js') diff --git a/node_modules/array-find-index/index.js b/node_modules/array-find-index/index.js new file mode 100644 index 000000000..e2dcd9a09 --- /dev/null +++ b/node_modules/array-find-index/index.js @@ -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; +}; -- cgit v1.2.3