(items: (PackItem | Item)[])
| 10 | }; |
| 11 | |
| 12 | export const getItemsByCategory = (items: (PackItem | Item)[]): CategoryItems[] => { |
| 13 | const categories = getCategories(items); |
| 14 | return categories.map(category => { |
| 15 | const catItems = items.filter(i => i.categoryId === category.id); |
| 16 | return { |
| 17 | ...category, |
| 18 | items: catItems |
| 19 | } |
| 20 | }); |
| 21 | }; |
| 22 | |
| 23 | // handles the weirdness between categories with IDs and those without Ids |
| 24 | export const categorySelectValue = (categories: Category[], value: number | string | undefined): Option | undefined => { |
no test coverage detected