Permalink
Browse files

Issue #103, change initial value detection for reduce()

  • Loading branch information...
1 parent cd236d4 commit 174c897fced7bdfd4841103dcb53c468c79ffe37 @jashkenas committed Jul 13, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 underscore.js
View
@@ -100,7 +100,7 @@
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
- var initial = memo !== void 0;
+ var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduce && obj.reduce === nativeReduce) {
if (context) iterator = _.bind(iterator, context);

0 comments on commit 174c897

Please sign in to comment.