Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

every.js 554B

1234567891011121314151617
  1. var keys = require('./keys.js');
  2. var _cb = require('./_cb.js');
  3. var _isArrayLike = require('./_isArrayLike.js');
  4. // Determine whether all of the elements pass a truth test.
  5. function every(obj, predicate, context) {
  6. predicate = _cb(predicate, context);
  7. var _keys = !_isArrayLike(obj) && keys(obj),
  8. length = (_keys || obj).length;
  9. for (var index = 0; index < length; index++) {
  10. var currentKey = _keys ? _keys[index] : index;
  11. if (!predicate(obj[currentKey], currentKey, obj)) return false;
  12. }
  13. return true;
  14. }
  15. module.exports = every;