From 23eba0a0297906238e2726d0aa7e9ebff0fc8209 Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 30 Apr 2015 23:50:58 -0700 Subject: [PATCH] Avoid `isArrayLike` in `createBaseEach` to bail out early when nullish. --- lodash.src.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 833f51bcf..fc12d1e18 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3290,11 +3290,11 @@ */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { - if (!isArrayLike(collection)) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { return eachFunc(collection, iteratee); } - var length = collection.length, - index = fromRight ? length : -1, + var index = fromRight ? length : -1, iterable = toObject(collection); while ((fromRight ? index-- : ++index < length)) {