| var isArrayLike = require('./isArrayLike'); |
| * Creates a `baseEach` or `baseEachRight` function. |
| * @param {Function} eachFunc The function to iterate over a collection. |
| * @param {boolean} [fromRight] Specify iterating from right to left. |
| * @returns {Function} Returns the new base function. |
| function createBaseEach(eachFunc, fromRight) { |
| return function(collection, iteratee) { |
| if (collection == null) { |
| if (!isArrayLike(collection)) { |
| return eachFunc(collection, iteratee); |
| var length = collection.length, |
| index = fromRight ? length : -1, |
| iterable = Object(collection); |
| while ((fromRight ? index-- : ++index < length)) { |
| if (iteratee(iterable[index], index, iterable) === false) { |
| module.exports = createBaseEach; |