refactor: js output

This commit is contained in:
Tiara Rodney 2026-03-15 05:11:59 +01:00
parent 1aa28c2a34
commit c6704c3a04
Signed by: tiara
GPG key ID: 5CD8EC1D46106723
96 changed files with 3816 additions and 147 deletions

33
src/sprint.js Normal file
View file

@ -0,0 +1,33 @@
export function parseSprints(text) {
const lines = text.split(/\r?\n/);
const sprints = [];
let current = null;
for (const line of lines) {
// Start of sprint entry (must not trim indentation)
if (/^\s*-\s*(Name:.*)?$/.test(line)) {
if (current)
sprints.push(current);
current = {};
const match = line.match(/^\s*-\s*Name:\s*(.*)$/);
if (match)
current.name = match[1];
continue;
}
// Key-value pairs (must be indented)
const kv = line.match(/^\s+([A-Za-z][A-Za-z0-9]*):\s*(.*)$/);
if (kv && current) {
const key = kv[1];
const value = kv[2];
if (key === "Name")
current.name = value;
if (key === "Range") {
const [start, end] = value.split("..");
current.start = start;
current.end = end;
}
}
}
if (current)
sprints.push(current);
return sprints;
}