Add _.groupBy test for passing numbers for the callback argument.

Former-commit-id: 6ce29f81f8688495a8a756e464b32e9e825c7857
This commit is contained in:
John-David Dalton
2013-02-13 19:54:39 -08:00
parent aeea861b73
commit 1090228628

View File

@@ -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']] });
});
}());
/*--------------------------------------------------------------------------*/