/** * Groups elements of an array into an object based on a key function. * * Iterates over the input array and groups items by the string key returned by the key function. * Each key maps to an array of items that share that key. * * @template T The type of elements in the input array. * @param array - The array of items to group. * @param keyFn - A function that takes an item and returns a string key to group by. * @returns An object where each key is associated with an array of items that share that key. * * @example * ```ts * const data = [ * { type: 'fruit', name: 'apple' }, * { type: 'vegetable', name: 'carrot' }, * { type: 'fruit', name: 'banana' } * ]; * * const grouped = groupBy(data, item => item.type); * // { * // fruit: [ * // { type: 'fruit', name: 'apple' }, * // { type: 'fruit', name: 'banana' } * // ], * // vegetable: [ * // { type: 'vegetable', name: 'carrot' } * // ] * // } * ``` */ export declare function groupBy(array: T[], keyFn: (item: T) => string): Record; //# sourceMappingURL=group-by.d.ts.map