MCPcopy Create free account
hub / github.com/arktypeio/arktype / groupsOf

Function groupsOf

ark/docs/components/shell/Sidebar.tsx:98–105  ·  view source on GitHub ↗
(items: NavItem[])

Source from the content-addressed store, hash-verified

96type Group = { title?: string; items: NavItem[] }
97
98const groupsOf = (items: NavItem[]): Group[] => {
99 const groups: Group[] = [{ items: [] }]
100 for (const item of items) {
101 if (item.kind === "separator") groups.push({ title: item.title, items: [] })
102 else groups.at(-1)!.items.push(item)
103 }
104 return groups.filter(group => group.items.length)
105}
106
107/** where a folder without a page of its own leads: its first page */
108const pageUrlOf = (item: NavItem): string | undefined =>

Callers 1

SidebarFunction · 0.70

Calls 3

filterMethod · 0.80
pushMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected