14 lines
356 B
TypeScript
14 lines
356 B
TypeScript
/**
|
|
* Returns the group names from an Xref header,
|
|
* e.g. `news.eweka.nl alt.binaries.test:123 alt.binaries.x:456`.
|
|
*/
|
|
export function parseXrefGroups(xref: string | undefined): string[] {
|
|
if (!xref) return []
|
|
return xref
|
|
.trim()
|
|
.split(/\s+/)
|
|
.slice(1)
|
|
.map((entry) => entry.slice(0, entry.lastIndexOf(':')))
|
|
.filter(Boolean)
|
|
}
|