Reduce _.reduceRight and update vendors.

Former-commit-id: f7250ccb4b8f15052c1f1420947c2ac68963a92c
This commit is contained in:
John-David Dalton
2012-09-20 21:06:32 -07:00
parent 5afeed56ef
commit 473dd7660b
8 changed files with 130 additions and 120 deletions

View File

@@ -107,6 +107,9 @@ $(document).ready(function() {
}
ok(ifnull instanceof TypeError, 'handles a null (without inital value) properly');
var sum = _.reduceRight({a: 1, b: 2, c: 3}, function(sum, num){ return sum + num; });
equal(sum, 6, 'default initial value on object');
ok(_.reduceRight(null, function(){}, 138) === 138, 'handles a null (with initial value) properly');
equal(_.reduceRight([], function(){}, undefined), undefined, 'undefined can be passed as a special case');
@@ -326,6 +329,13 @@ $(document).ready(function() {
var context = {};
_.groupBy([{}], function(){ ok(this === context); }, context);
grouped = _.groupBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
});
equal(grouped.constructor.length, 1);
equal(grouped.hasOwnProperty.length, 2);
});
test('countBy', function() {
@@ -341,6 +351,12 @@ $(document).ready(function() {
var context = {};
_.countBy([{}], function(){ ok(this === context); }, context);
grouped = _.countBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
});
equal(grouped.constructor, 1);
equal(grouped.hasOwnProperty, 2);
});
test('sortedIndex', function() {