Skip to content

Commit

Permalink
Added ignoreNewlineAtEof option to diffLines
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-ka committed Oct 1, 2024
1 parent 911509d commit 91b6060
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions types/diff/diff-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Diff.diffLines(
'line\nold value\nline',
'line\nnew value\nline',
{
ignoreNewlineAtEof: true,
maxEditLength: 1,
oneChangePerToken: true,
},
Expand Down
5 changes: 5 additions & 0 deletions types/diff/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export interface WordsOptions extends BaseOptions {
}

export interface LinesOptions extends BaseOptions {
/**
* `true` to ignore a missing newline character at the end of the last line when comparing it to other lines. (By default, the line `'b\n'` in text `'a\nb\nc'` is not considered equal to the line `'b'` in text `'a\nb'`; this option makes them be considered equal.) Ignored if `ignoreWhitespace` or `newlineIsToken` are also true.
*/
ignoreNewlineAtEof?: boolean | undefined;

/**
* `true` to ignore leading and trailing whitespace. This is the same as `diffTrimmedLines()`.
*/
Expand Down

0 comments on commit 91b6060

Please sign in to comment.