( a: string, b: string, labelA: string, labelB: string, contextLines = 3 )
| 1688 | // ── Diff helpers ───────────────────────────────────────────────────── |
| 1689 | |
| 1690 | function unifiedDiff( |
| 1691 | a: string, |
| 1692 | b: string, |
| 1693 | labelA: string, |
| 1694 | labelB: string, |
| 1695 | contextLines = 3 |
| 1696 | ): string { |
| 1697 | if (a === b) return ""; |
| 1698 | |
| 1699 | const linesA = a.split("\n"); |
| 1700 | const linesB = b.split("\n"); |
| 1701 | const edits = myersDiff(linesA, linesB); |
| 1702 | return formatUnified(edits, linesA, linesB, labelA, labelB, contextLines); |
| 1703 | } |
| 1704 | |
| 1705 | type Edit = { |
| 1706 | type: "keep" | "delete" | "insert"; |
no test coverage detected