-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup-by.d.ts
19 lines (18 loc) · 1.05 KB
/
group-by.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
* Groups each item in the list by a defined callback return value.
* Input is expected to be an array-like structure and return value will be a standard map/object.
*
* @param list Array to group.
* @param callback Callback to execute on each object in the array to fetch key for grouping.
* @return Object in which keys are selected from passed list and the items are the items which are grouped under the key.
*/
export default function groupBy(list: any[], callback: (any) => void): object;
/**
* Groups each item in the list by a defined callback return value.
* Input is expected to be an array-like structure and return value will be a standard map/object.
*
* @param list Array to group.
* @param callback Callback to execute on each object in the array to fetch key for grouping.
* @return Promise<Object> in which keys are selected from passed list and the items are the items which are grouped under the key.
*/
export function groupByAsync(list: any[], callback: (any) => Promise<void>): Promise<object>