Ensure _.reduce doesn't assign accumulator a collection value if its length is 0.

This commit is contained in:
John-David Dalton
2013-12-25 00:21:45 -06:00
parent 2dab4ccf85
commit 0438fa6816
5 changed files with 41 additions and 27 deletions

View File

@@ -4126,7 +4126,7 @@
var index = -1,
length = collection.length;
if (noaccum) {
if (noaccum && length) {
accumulator = collection[++index];
}
while (++index < length) {