(lines: string[], key: string)
| 148 | } |
| 149 | |
| 150 | function topLevelRange(lines: string[], key: string): LineRange | null { |
| 151 | const start = lines.findIndex((line) => line.trim() === `${key}:`); |
| 152 | if (start === -1) return null; |
| 153 | let end = lines.length; |
| 154 | for (let i = start + 1; i < lines.length; i++) { |
| 155 | const line = lines[i] ?? ''; |
| 156 | if (line.trim() === '') continue; |
| 157 | if (/^[A-Za-z_][A-Za-z0-9_-]*:\s*(?:#.*)?$/.test(line)) { |
| 158 | end = i; |
| 159 | break; |
| 160 | } |
| 161 | } |
| 162 | return { start, end }; |
| 163 | } |
| 164 | |
| 165 | function childRange(lines: string[], parent: LineRange, child: string): LineRange | null { |
| 166 | const startPattern = new RegExp(`^ ${escapeRegExp(child)}:\\s*(?:#.*)?$`); |
no outgoing calls
no test coverage detected