mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 07:17:50 +00:00
22 lines
487 B
JavaScript
22 lines
487 B
JavaScript
/**
|
|
* A specialized version of `forEach` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function arrayEach(array, iteratee) {
|
|
let index = -1
|
|
const length = array == null ? 0 : array.length
|
|
|
|
while (++index < length) {
|
|
if (iteratee(array[index], index, array) === false) {
|
|
break
|
|
}
|
|
}
|
|
return array
|
|
}
|
|
|
|
export default arrayEach
|