groupBy_.groupBy(list, iteratee, [context])
Splits a collection into sets, grouped by the result of running each value through iteratee. If iteratee is a string instead of a function, groups by the property named by iteratee on each of the values.
1 2 3 4 5 | _.groupBy([1.3, 2.1, 2.4], function (num){ return Math.floor(num); }); => {1: [1.3], 2: [2.1, 2.4]} _.groupBy([ 'one' , 'two' , 'three' ], 'length' ); => {3: [ "one" , "two" ], 5: [ "three" ]} |
Please login to continue.