lang/array.js
/**
		 * Splits array into groups and returns an object (where the properties have
		 * arrays). Unlike the indexBy function, there can be many items which share
		 * the same key.
		 *
		 * @static
		 * @param {Array} a
		 * @param {Function} keySelector - A function that returns a unique key for an item.
		 * @returns {Object}
		 */
Splits array into groups and returns an object (where the properties have
arrays). Unlike the indexBy function, there can be many items which share
the same key.

@static
@param {Array} a
@param {Function} keySelector - A function that returns a unique key for an item.
@returns {Object}
Splits array into groups and returns an object ( where the properties have arrays ) . Unlike the indexBy function there can be many items which share the same key . @static @param { Array } a @param { Function } keySelector - A function that returns a unique key for an item . @returns { Object }
groupBy(a, keySelector) {
			assert.argumentIsArray(a, 'a');
			assert.argumentIsRequired(keySelector, 'keySelector', Function);
			return a.reduce((groups, item) => {
				const key = keySelector(item);
				if (!groups.hasOwnProperty(key)) {
					groups[key] = [ ];
				}
				groups[key].push(item);
				return groups;
			}, { });
		}
groupBy ( a , keySelector ) { assert . argumentIsArray ( a , 'a' ) ; assert . argumentIsRequired ( keySelector , 'keySelector' , Function ) ; return a . reduce ( ( groups , item ) => { const key = keySelector ( item ) ; if ( ! groups . hasOwnProperty ( key ) ) { groups [ key ] = [ ] ; } groups [ key ] . push ( item ) ; return groups ; } , { } ) ; }
Splits array into groups and returns an object (where the properties have
 arrays).
Splits array into groups and returns an object ( where the properties have arrays ) .