function
diff.hunks
Compare two strings line by line and group the changes into the hunks of a unified diff.
The hunks, or undefined if there are more than maxEditLength edits
Compare two strings line by line and group the changes into the hunks of a unified diff.
The hunks, or undefined if there are more than maxEditLength edits
Referenced types
interface HunksOptions
- context?: number
The number of unchanged lines before and after each change, like
diff -U. An integer from 0, orInfinityfor the whole file. - maxEditLength?: number
Return
undefinedwhen the diff adds and removes more than this many tokens in total. An integer from 0, orInfinity.
interface Hunk
One @@ section of a unified diff.
- lines: string[]
Each line without its
, after" "(kept),"-"(removed) or"+"(added)."\\ No newline at end of file"follows a line that has no
. - newStart: number
The first line of the hunk in the new text, from 1. If
newLinesis 0, the line after the hunk. - oldStart: number
The first line of the hunk in the old text, from 1. If
oldLinesis 0, the line after the hunk.