( input: string, diff: string, mode: DiffMode = 'default', )
| 446 | } |
| 447 | |
| 448 | function applyDiff( |
| 449 | input: string, |
| 450 | diff: string, |
| 451 | mode: DiffMode = 'default', |
| 452 | ): { result: string; fuzz: number } { |
| 453 | const diffLines = normalizeDiffLines(diff) |
| 454 | |
| 455 | if (mode === 'create') { |
| 456 | return { result: parseCreateDiff(diffLines), fuzz: 0 } |
| 457 | } |
| 458 | |
| 459 | const { chunks, fuzz } = parseUpdateDiff(diffLines, input) |
| 460 | return { result: applyChunks(input, chunks), fuzz } |
| 461 | } |
| 462 | |
| 463 | function isConsistentlyCrlf(input: string): boolean { |
| 464 | const hasCrlf = /\r\n/.test(input) |
no test coverage detected