mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Bump to v4.0.0.
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import getLength from './getLength';
|
||||
import isLength from './isLength';
|
||||
import toObject from './toObject';
|
||||
import isArrayLike from '../isArrayLike';
|
||||
|
||||
/**
|
||||
* Creates a `baseEach` or `baseEachRight` function.
|
||||
@@ -12,12 +10,15 @@ import toObject from './toObject';
|
||||
*/
|
||||
function createBaseEach(eachFunc, fromRight) {
|
||||
return function(collection, iteratee) {
|
||||
var length = collection ? getLength(collection) : 0;
|
||||
if (!isLength(length)) {
|
||||
if (collection == null) {
|
||||
return collection;
|
||||
}
|
||||
if (!isArrayLike(collection)) {
|
||||
return eachFunc(collection, iteratee);
|
||||
}
|
||||
var index = fromRight ? length : -1,
|
||||
iterable = toObject(collection);
|
||||
var length = collection.length,
|
||||
index = fromRight ? length : -1,
|
||||
iterable = Object(collection);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
if (iteratee(iterable[index], index, iterable) === false) {
|
||||
|
||||
Reference in New Issue
Block a user