| 1 | export function formatCurrency(amount: number, currency: string) { |
| 2 | return new Intl |
| 3 | style: 'currency', |
| 4 | currency, |
| 5 | maximumFractionDigits: amount % |
| 6 | }).format(amount |
| 7 | } |
| 8 | |
| 9 | export function sumByCurrency<T |
| 10 | list: T |
| 11 | value: (item |
| 12 | ) { |
| 13 | const totals: |
| 14 | for (const item |
| 15 | totals[item.currency |
| 16 | } |
| 17 | return totals |
| 18 | } |