summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/shim.js
blob: 957939f2ba224a8808c06f60de686a1c6289894d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';

var callable = require('../../../object/valid-callable')
  , value    = require('../../../object/valid-value')

  , some = Array.prototype.some, apply = Function.prototype.apply;

module.exports = function (predicate/*, thisArg*/) {
	var k, self;
	self = Object(value(this));
	callable(predicate);

	return some.call(self, function (value, index) {
		if (apply.call(predicate, this, arguments)) {
			k = index;
			return true;
		}
		return false;
	}, arguments[1]) ? k : -1;
};