13 lines
295 B
TypeScript
13 lines
295 B
TypeScript
import type { Breadcrumb } from "./types"
|
|
|
|
function splitBreadcrumbs(
|
|
breadcrumbs: Breadcrumb[]
|
|
): [Breadcrumb, Breadcrumb[], Breadcrumb] {
|
|
const copy = breadcrumbs.slice(0)
|
|
const first = copy.shift()!
|
|
const last = copy.pop()!
|
|
return [first, copy, last]
|
|
}
|
|
|
|
export { splitBreadcrumbs }
|