mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Avoid isArrayLike in createBaseEach to bail out early when nullish.
This commit is contained in:
@@ -3290,11 +3290,11 @@
|
|||||||
*/
|
*/
|
||||||
function createBaseEach(eachFunc, fromRight) {
|
function createBaseEach(eachFunc, fromRight) {
|
||||||
return function(collection, iteratee) {
|
return function(collection, iteratee) {
|
||||||
if (!isArrayLike(collection)) {
|
var length = collection ? getLength(collection) : 0;
|
||||||
|
if (!isLength(length)) {
|
||||||
return eachFunc(collection, iteratee);
|
return eachFunc(collection, iteratee);
|
||||||
}
|
}
|
||||||
var length = collection.length,
|
var index = fromRight ? length : -1,
|
||||||
index = fromRight ? length : -1,
|
|
||||||
iterable = toObject(collection);
|
iterable = toObject(collection);
|
||||||
|
|
||||||
while ((fromRight ? index-- : ++index < length)) {
|
while ((fromRight ? index-- : ++index < length)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user