MCPcopy
hub / github.com/jestjs/jest / printDiffLine

Function printDiffLine

packages/jest-diff/src/joinAlignedDiffs.ts:21–37  ·  view source on GitHub ↗
(
  line: string,
  isFirstOrLast: boolean,
  color: DiffOptionsColor,
  indicator: string,
  trailingSpaceFormatter: DiffOptionsColor,
  emptyFirstOrLastLinePlaceholder: string,
)

Source from the content-addressed store, hash-verified

19): string => line.replace(/\s+$/, match => trailingSpaceFormatter(match));
20
21const printDiffLine = (
22 line: string,
23 isFirstOrLast: boolean,
24 color: DiffOptionsColor,
25 indicator: string,
26 trailingSpaceFormatter: DiffOptionsColor,
27 emptyFirstOrLastLinePlaceholder: string,
28): string =>
29 line.length === 0
30 ? indicator === ' '
31 ? isFirstOrLast && emptyFirstOrLastLinePlaceholder.length > 0
32 ? color(`${indicator} ${emptyFirstOrLastLinePlaceholder}`)
33 : ''
34 : color(indicator)
35 : color(
36 `${indicator} ${formatTrailingSpaces(line, trailingSpaceFormatter)}`,
37 );
38
39const printDeleteLine = (
40 line: string,

Callers 3

printDeleteLineFunction · 0.85
printInsertLineFunction · 0.85
printCommonLineFunction · 0.85

Calls 1

formatTrailingSpacesFunction · 0.85

Tested by

no test coverage detected