MCPcopy Create free account
hub / github.com/vitest-dev/vitest / printDiffLine

Function printDiffLine

packages/utils/src/diff/joinAlignedDiffs.ts:19–36  ·  view source on GitHub ↗
(
  line: string,
  isFirstOrLast: boolean,
  color: DiffOptionsColor,
  indicator: string,
  trailingSpaceFormatter: DiffOptionsColor,
  emptyFirstOrLastLinePlaceholder: string,
)

Source from the content-addressed store, hash-verified

17}
18
19function printDiffLine(
20 line: string,
21 isFirstOrLast: boolean,
22 color: DiffOptionsColor,
23 indicator: string,
24 trailingSpaceFormatter: DiffOptionsColor,
25 emptyFirstOrLastLinePlaceholder: string,
26): string {
27 return line.length !== 0
28 ? color(
29 `${indicator} ${formatTrailingSpaces(line, trailingSpaceFormatter)}`,
30 )
31 : indicator !== ' '
32 ? color(indicator)
33 : isFirstOrLast && emptyFirstOrLastLinePlaceholder.length !== 0
34 ? color(`${indicator} ${emptyFirstOrLastLinePlaceholder}`)
35 : ''
36}
37
38function printDeleteLine(
39 line: string,

Callers 3

printDeleteLineFunction · 0.85
printInsertLineFunction · 0.85
printCommonLineFunction · 0.85

Calls 1

formatTrailingSpacesFunction · 0.85

Tested by

no test coverage detected