export declare type GroupedElements = { [groupId in GroupIdType]: ElementType[]; }; /** * Creates an object where the key is the group id and the value is an array of elements grouped by this id. * * @param array - The array to group elements from * @param mapper - The function that returns the group id * @returns An object where the key is the group id and the value is an array of elements grouped by this id * * @public */ export default function group(arr: ElementType[], mapper: (element: ElementType, index: number) => GroupIdType): GroupedElements; /** * Creates an object where the key is the group id and the value is an array of elements grouped by this id. * * @param array - The array to group elements from * @param key - The name of the field to use as the id * @returns An object where the key is the group id and the value is an array of elements grouped by this id * * @public */ export default function group(arr: ElementType[], key: Key): GroupIdType extends number | string ? GroupedElements : never;