some-right.js 585 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var toPosInt = require('../../number/to-pos-integer')
  3. , callable = require('../../object/valid-callable')
  4. , value = require('../../object/valid-value')
  5. , hasOwnProperty = Object.prototype.hasOwnProperty
  6. , call = Function.prototype.call;
  7. module.exports = function (cb/*, thisArg*/) {
  8. var i, self, thisArg;
  9. self = Object(value(this));
  10. callable(cb);
  11. thisArg = arguments[1];
  12. for (i = (toPosInt(self.length) - 1); i >= 0; --i) {
  13. if (hasOwnProperty.call(self, i) &&
  14. call.call(cb, thisArg, self[i], i, self)) {
  15. return true;
  16. }
  17. }
  18. return false;
  19. };