Ensure _.flatten handles empty arrays.

This commit is contained in:
John-David Dalton
2013-09-17 19:29:09 -07:00
parent 55f080e33f
commit 620866bc39
8 changed files with 17 additions and 8 deletions

View File

@@ -419,7 +419,8 @@
while (++index < length) {
var value = array[index];
if (value && typeof value == 'object' && value.length && (isArray(value) || isArguments(value))) {
if (value && typeof value == 'object' && typeof value.length == 'number'
&& (isArray(value) || isArguments(value))) {
// recursively flatten arrays (susceptible to call stack limits)
if (!isShallow) {
value = baseFlatten(value, isShallow, isArgArrays);