The root each marker block in `content` names (null for an older block).
(content: string)
| 155 | |
| 156 | /** The root each marker block in `content` names (null for an older block). */ |
| 157 | function blockRoots(content: string): (string | null)[] { |
| 158 | const roots: (string | null)[] = []; |
| 159 | let current: string | null | undefined; |
| 160 | for (const line of content.split('\n')) { |
| 161 | const trimmed = line.trim(); |
| 162 | if (trimmed === MARKER_BEGIN) { current = null; continue; } |
| 163 | if (current === undefined) continue; |
| 164 | if (trimmed.startsWith(ROOT_PREFIX)) { current = trimmed.slice(ROOT_PREFIX.length); continue; } |
| 165 | if (trimmed === MARKER_END) { roots.push(current); current = undefined; } |
| 166 | } |
| 167 | return roots; |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * Remove the marker blocks `owns` claims (and the blank line that follows |
no test coverage detected