Avoid isArrayLike in createBaseEach to bail out early when nullish.

This commit is contained in:
jdalton
2015-04-30 23:50:58 -07:00
parent 566781cab2
commit 23eba0a029

View File

@@ -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)) {