(diffs: Diff[])
| 48 | * @returns An object containing the left and right differences. |
| 49 | */ |
| 50 | export function classify(diffs: Diff[]): { left: Diff[]; right: Diff[] } { |
| 51 | const left = sort(diffs.filter((d) => d.type === "del")); |
| 52 | const right = sort(diffs.filter((d) => d.type === "ins")); |
| 53 | return { left, right }; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Sorts an array of differences by type and offset. |