mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Move _.groupBy and _.sortBy back to the "Collections" category. [closes #34]
Former-commit-id: ce0f7f906758ce13cc2ea927520ac401e6bba9f6
This commit is contained in:
16
test/test.js
16
test/test.js
@@ -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]);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user