All files body-digest.ts

100% Statements 5/5
100% Branches 4/4
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                              4x 10x 4x    
/**
 * Shared body-digest leaf primitives.
 *
 * The per-language comment strippers (`stripGoComments`,
 * `stripRustComments` with nested block comments + char-vs-lifetime
 * heuristic, `stripPythonComments` + docstring strip, Java's stripper)
 * stay in each adapter's `body-digest.ts` — they are genuinely
 * language-specific. Only the byte-identical `skipToEndOfLine` primitive
 * (scan from `start` to the next newline) is shared here; each adapter's
 * `digestXBody = hashBody(normalizeWhitespace(stripXComments(text)))`
 * wiring and its `digestSyntheticBody` alias remain adapter-owned.
 */
 
/** Advance from `start` to the index of the next `\n` (or end of text). */
export function skipToEndOfLine(text: string, start: number): number {
  let i = start;
  while (i < text.length && text[i] !== '\n') i++;
  return i;
}