_arrayEach.js 537 B

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