lang/array.js
/**
		 * Splits array into groups and returns an object (where the properties are items from the
		 * original array). Unlike the groupBy, only one item can have a given key value.
		 *
		 * @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 are items from the
original array). Unlike the groupBy, only one item can have a given key value.

@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 are items from the original array ) . Unlike the groupBy only one item can have a given key value . @static @param { Array } a @param { Function } keySelector - A function that returns a unique key for an item . @returns { Object }
indexBy(a, keySelector) {
			assert.argumentIsArray(a, 'a');
			assert.argumentIsRequired(keySelector, 'keySelector', Function);
			return a.reduce((map, item) => {
				const key = keySelector(item);
				if (map.hasOwnProperty(key)) {
					throw new Error('Unable to index array. A duplicate key exists.');
				}
				map[key] = item;
				return map;
			}, { });
		}
indexBy ( a , keySelector ) { assert . argumentIsArray ( a , 'a' ) ; assert . argumentIsRequired ( keySelector , 'keySelector' , Function ) ; return a . reduce ( ( map , item ) => { const key = keySelector ( item ) ; if ( map . hasOwnProperty ( key ) ) { throw new Error ( 'Unable to index array. A duplicate key exists.' ) ; } map [ key ] = item ; return map ; } , { } ) ; }
Splits array into groups and returns an object (where the properties are items from the
 original array).
Splits array into groups and returns an object ( where the properties are items from the original array ) .