(slug: string)
| 1 | export function splitSlug(slug: string) { |
| 2 | const parts = slug.split("/").filter(Boolean) |
| 3 | if (parts.length === 2) { |
| 4 | const [section, filename] = parts |
| 5 | return { section, filename } |
| 6 | } |
| 7 | |
| 8 | if (parts.length === 3) { |
| 9 | const [section, subsection, filename] = parts |
| 10 | return { section, subsection, filename } |
| 11 | } |
| 12 | |
| 13 | throw new Error( |
| 14 | `Invalid slug format: expected "section/page" or "section/subsection/page" but got ${parts.length} segments — slug: ${slug}` |
| 15 | ) |
| 16 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…