MCPcopy Create free account
hub / github.com/Packstack-Tech/packstack / getCategories

Function getCategories

frontend/src/lib/utils/categories.ts:7–10  ·  view source on GitHub ↗
(items: (PackItem | Item)[])

Source from the content-addressed store, hash-verified

5import { Option } from "app/components/FormFields/types";
6
7export const getCategories = (items: (PackItem | Item)[]): Category[] => {
8 const categories = items.map(item => item.Category);
9 return uniqBy(categories, 'id').sort((a, b) => a.id - b.id);
10};
11
12export const getItemsByCategory = (items: (PackItem | Item)[]): CategoryItems[] => {
13 const categories = getCategories(items);

Callers 5

PackItemsFunction · 0.90
InventorySidebarFunction · 0.90
ItemsFunction · 0.90
fetchItemsFunction · 0.90
getItemsByCategoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected