1
0

shim.js 493 B

1234567891011121314151617181920
  1. 'use strict';
  2. var callable = require('../../../object/valid-callable')
  3. , value = require('../../../object/valid-value')
  4. , some = Array.prototype.some, apply = Function.prototype.apply;
  5. module.exports = function (predicate/*, thisArg*/) {
  6. var k, self;
  7. self = Object(value(this));
  8. callable(predicate);
  9. return some.call(self, function (value, index) {
  10. if (apply.call(predicate, this, arguments)) {
  11. k = index;
  12. return true;
  13. }
  14. return false;
  15. }, arguments[1]) ? k : -1;
  16. };