(patch: Diff.ParsedDiff)
| 20 | userStr: string, |
| 21 | ): DiffStat { |
| 22 | const countLines = (patch: Diff.ParsedDiff) => { |
| 23 | let added = 0; |
| 24 | let removed = 0; |
| 25 | patch.hunks.forEach((hunk: Diff.Hunk) => { |
| 26 | hunk.lines.forEach((line: string) => { |
| 27 | if (line.startsWith('+')) { |
| 28 | added++; |
| 29 | } else if (line.startsWith('-')) { |
| 30 | removed++; |
| 31 | } |
| 32 | }); |
| 33 | }); |
| 34 | return { added, removed }; |
| 35 | }; |
| 36 | |
| 37 | const patch = Diff.structuredPatch( |
| 38 | fileName, |