Reduce _.isEmpty.

This commit is contained in:
John-David Dalton
2015-08-01 11:03:33 -07:00
parent a3b76f9259
commit f5714f2eb0

View File

@@ -6427,7 +6427,8 @@
if (collection == null) { if (collection == null) {
return 0; return 0;
} }
return isArrayLike(collection) ? collection.length : keys(collection).length; collection = isArrayLike(collection) ? collection : keys(collection);
return collection.length;
} }
/** /**
@@ -7926,14 +7927,9 @@
* // => false * // => false
*/ */
function isEmpty(value) { function isEmpty(value) {
if (value == null) { return (!isObjectLike(value) || isFunction(value.splice))
return true; ? !size(value)
} : !keys(value).length;
if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
(isObjectLike(value) && isFunction(value.splice)))) {
return !value.length;
}
return !keys(value).length;
} }
/** /**