Move _.groupBy and _.sortBy back to the "Collections" category. [closes #34]

Former-commit-id: ce0f7f906758ce13cc2ea927520ac401e6bba9f6
This commit is contained in:
John-David Dalton
2012-06-26 02:18:44 -04:00
parent 6fa5b13e10
commit 313ee13f18
3 changed files with 115 additions and 112 deletions

View File

@@ -327,6 +327,14 @@
deepEqual(actual.constructor, [1.3]);
deepEqual(actual.hasOwnProperty, [2.1, 2.4]);
});
test('should work with an object for `collection`', function() {
var actual = _.groupBy({ 'a': 1.3, 'b': 2.1, 'c': 2.4 }, function(num) {
return Math.floor(num);
});
deepEqual(actual, { '1': [1.3], '2': [2.1, 2.4] });
});
}());
/*--------------------------------------------------------------------------*/
@@ -595,6 +603,14 @@
deepEqual(actual, [3, 1, 2]);
});
test('should work with an object for `collection`', function() {
var actual = _.sortBy({ 'a': 1, 'b': 2, 'c': 3 }, function(num) {
return Math.sin(num);
});
deepEqual(actual, [3, 1, 2]);
});
}());
/*--------------------------------------------------------------------------*/