Segment files of one run, in turn order: run-X.jsonl, run-X.t2.jsonl, …
(dir, stem)
| 25 | |
| 26 | /** Segment files of one run, in turn order: run-X.jsonl, run-X.t2.jsonl, … */ |
| 27 | function segmentsOf(dir, stem) { |
| 28 | const first = join(dir, `${stem}.jsonl`); |
| 29 | if (!existsSync(first)) return null; |
| 30 | const rest = readdirSync(dir) |
| 31 | .map((f) => [f, new RegExp(`^${stem.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\.t(\\d+)\\.jsonl$`).exec(f)]) |
| 32 | .filter(([, m]) => m) |
| 33 | .sort((a, b) => Number(a[1][1]) - Number(b[1][1])) |
| 34 | .map(([f]) => join(dir, f)); |
| 35 | return [first, ...rest]; |
| 36 | } |
| 37 | |
| 38 | /** Every run of one arm, newest-numbering-first-run order. */ |
| 39 | export function discoverRuns(dir, label) { |
no test coverage detected