All files / src delivery-path.ts

100% Statements 20/20
86.66% Branches 13/15
100% Functions 9/9
100% Lines 20/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 215x 1x 1x 1x 5x 5x 5x 5x 5x 1x 1x 5x 4x 4x 4x 5x 1x 1x 1x 1x  
export type DeliveryFolder = "us" | "epics" | "versions" | "sprints"
 
/** Parse `us/US-0125.md` style paths used by board and planning panels. */
export function parseDeliveryRelativePath(
  relativePath: string,
): { folder: DeliveryFolder; id: string } | null {
  const normalized = relativePath.replace(/\\/g, "/")
  const match = normalized.match(/^(us|epics|versions|sprints)\/([^/]+)\.md$/i)
  if (!match) {
    return null
  }
  return {
    folder: match[1].toLowerCase() as DeliveryFolder,
    id: match[2],
  }
}
 
export function deliveryRelativePath(folder: DeliveryFolder, id: string): string {
  return `${folder}/${id}.md`
}