some-right.js 624 B

123456789101112131415161718192021
  1. "use strict";
  2. var toPosInt = require("../../number/to-pos-integer")
  3. , callable = require("../../object/valid-callable")
  4. , value = require("../../object/valid-value")
  5. , objHasOwnProperty = 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 (objHasOwnProperty.call(self, i) && call.call(cb, thisArg, self[i], i, self)) {
  14. return true;
  15. }
  16. }
  17. return false;
  18. };