some.js 490 B

123456789101112131415161718192021
  1. var forOwn = require('./forOwn');
  2. var makeIterator = require('../function/makeIterator_');
  3. /**
  4. * Object some
  5. */
  6. function some(obj, callback, thisObj) {
  7. callback = makeIterator(callback, thisObj);
  8. var result = false;
  9. forOwn(obj, function(val, key) {
  10. if (callback(val, key, obj)) {
  11. result = true;
  12. return false; // break
  13. }
  14. });
  15. return result;
  16. }
  17. module.exports = some;