MCPcopy
hub / github.com/vitest-dev/vitest / getCommonAndChangedSubstrings

Function getCommonAndChangedSubstrings

packages/utils/src/diff/index.ts:438–451  ·  view source on GitHub ↗
(diffs: Array<Diff>, op: number, hasCommonDiff: boolean)

Source from the content-addressed store, hash-verified

436}
437
438function getCommonAndChangedSubstrings(diffs: Array<Diff>, op: number, hasCommonDiff: boolean): string {
439 return diffs.reduce(
440 (reduced: string, diff: Diff): string =>
441 reduced
442 + (diff[0] === DIFF_EQUAL
443 ? diff[1]
444 : diff[0] === op
445 ? hasCommonDiff
446 ? c.inverse(diff[1])
447 : diff[1]
448 : ''),
449 '',
450 )
451}

Callers 1

printDiffOrStringifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected