MCPcopy Index your code
hub / github.com/npmx-dev/npmx.dev / createDiff

Function createDiff

shared/utils/diff.ts:345–363  ·  view source on GitHub ↗
(
  oldContent: string,
  newContent: string,
  filePath: string,
  options: Partial<ParseOptions> = {},
)

Source from the content-addressed store, hash-verified

343}
344
345export function createDiff(
346 oldContent: string,
347 newContent: string,
348 filePath: string,
349 options: Partial<ParseOptions> = {},
350): FileDiff | null {
351 const diffText = createTwoFilesPatch(
352 `a/${filePath}`,
353 `b/${filePath}`,
354 oldContent,
355 newContent,
356 '',
357 '',
358 { context: 3 },
359 )
360
361 const files = parseUnifiedDiff(diffText, options)
362 return files[0] ?? null
363}
364
365export function countDiffStats(hunks: (DiffHunk | DiffSkipBlock)[]): {
366 additions: number

Callers 1

[...pkg].get.tsFile · 0.85

Calls 1

parseUnifiedDiffFunction · 0.85

Tested by

no test coverage detected