(unit: WeightUnit, items: (PackItem | Item)[])
| 69 | }; |
| 70 | |
| 71 | export const getWeightByCategory = (unit: WeightUnit, items: (PackItem | Item)[]): CategoryItemSpecs[] => { |
| 72 | const itemsByCategory = getItemsByCategory(items); |
| 73 | return itemsByCategory.map((category, i) => { |
| 74 | const weightSpecs = getTotalWeight(unit, category.items); |
| 75 | return { |
| 76 | ...category, |
| 77 | ...weightSpecs, |
| 78 | color: colors[i] |
| 79 | } |
| 80 | }).sort((a, b) => b.total.value - a.total.value); |
| 81 | }; |
no test coverage detected