You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
597 B

4 years ago
  1. /**
  2. * A specialized version of `_.every` for arrays without support for
  3. * iteratee shorthands.
  4. *
  5. * @private
  6. * @param {Array} [array] The array to iterate over.
  7. * @param {Function} predicate The function invoked per iteration.
  8. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9. * else `false`.
  10. */
  11. function arrayEvery(array, predicate) {
  12. var index = -1,
  13. length = array == null ? 0 : array.length;
  14. while (++index < length) {
  15. if (!predicate(array[index], index, array)) {
  16. return false;
  17. }
  18. }
  19. return true;
  20. }
  21. module.exports = arrayEvery;