mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Add _.groupBy test for passing numbers for the callback argument.
Former-commit-id: 6ce29f81f8688495a8a756e464b32e9e825c7857
This commit is contained in:
11
test/test.js
11
test/test.js
@@ -1014,6 +1014,17 @@
|
||||
|
||||
deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] });
|
||||
});
|
||||
|
||||
test('should work with a number for `callback`', function() {
|
||||
var array = [
|
||||
[1, 'a'],
|
||||
[2, 'a'],
|
||||
[2, 'b']
|
||||
];
|
||||
|
||||
deepEqual(_.groupBy(array, 0), { '1': [[1 , 'a']], '2': [[2, 'a'], [2, 'b']] });
|
||||
deepEqual(_.groupBy(array, 1), { 'a': [[1 , 'a'], [2, 'a']], 'b': [[2, 'b']] });
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user