(node: HTMLElement)
| 3 | export type DiffSelectionSide = "additions" | "deletions" |
| 4 | |
| 5 | export function findDiffSide(node: HTMLElement): DiffSelectionSide { |
| 6 | const line = node.closest("[data-line], [data-alt-line]") |
| 7 | if (line instanceof HTMLElement) { |
| 8 | const type = line.dataset.lineType |
| 9 | if (type === "change-deletion") return "deletions" |
| 10 | if (type === "change-addition" || type === "change-additions") return "additions" |
| 11 | } |
| 12 | |
| 13 | const code = node.closest("[data-code]") |
| 14 | if (!(code instanceof HTMLElement)) return "additions" |
| 15 | return code.hasAttribute("data-deletions") ? "deletions" : "additions" |
| 16 | } |
| 17 | |
| 18 | export function diffLineIndex(split: boolean, node: HTMLElement) { |
| 19 | const raw = node.dataset.lineIndex |
no outgoing calls
no test coverage detected