(diff: string)
| 103 | |
| 104 | /** Green `+N` / red `-N` counts, from the structural parse. */ |
| 105 | export function countDiffLineStats(diff: string): { additions: number; deletions: number } { |
| 106 | let additions = 0; |
| 107 | let deletions = 0; |
| 108 | for (const row of parseUnifiedDiffRows(diff)) { |
| 109 | if (row.kind === 'add') additions += 1; |
| 110 | else if (row.kind === 'del') deletions += 1; |
| 111 | } |
| 112 | return { additions, deletions }; |
| 113 | } |
no test coverage detected