mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
feat: upgrade prettier to v3
This commit is contained in:
@@ -20,8 +20,11 @@
|
||||
* iteratee is invoked with one argument: (value).
|
||||
*/
|
||||
export function keyBy<T>(collection: T[], key: (item: T) => string | number): Record<string, T> {
|
||||
return collection.reduce((accumulator, item) => {
|
||||
accumulator[key(item)] = item;
|
||||
return accumulator;
|
||||
}, {} as Record<string | number, T>);
|
||||
return collection.reduce(
|
||||
(accumulator, item) => {
|
||||
accumulator[key(item)] = item;
|
||||
return accumulator;
|
||||
},
|
||||
{} as Record<string | number, T>,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user