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

every.js 543B

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