feat: migrate to esm

This commit is contained in:
2023-03-16 01:58:13 +01:00
parent fd740b3091
commit 4df19e8c20
512 changed files with 3016 additions and 2222 deletions

View File

@@ -19,7 +19,10 @@
* each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*/
export function keyBy<T>(collection: T[], key: (item: T) => string | number): Record<string, T> {
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;