( arr: T[], key: K )
| 9 | } |
| 10 | |
| 11 | export const toObject = <T extends Record<string, any>, K extends keyof T>( |
| 12 | arr: T[], |
| 13 | key: K |
| 14 | ): Record<string, T> => arr.reduce((a, b) => ({ ...a, [b[key]]: b }), {}); |
| 15 | |
| 16 | export function sortBySentAtAsc(a: { sentAt: bigint }, b: { sentAt: bigint }) { |
| 17 | return Number(a.sentAt) - Number(b.sentAt); |