Skip to content

Commit

Permalink
this.options no longer exists on Diff objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-ka committed Oct 8, 2024
1 parent 3480728 commit 63252ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 13 additions & 0 deletions types/diff/diff-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,16 @@ const verifyPatch = Diff.parsePatch(
context: 1,
}),
);

const wordDiff = new Diff.Diff();
wordDiff.equals = function(left, right, options) {
if (options.ignoreWhitespace) {
if (!options.newlineIsToken || !left.includes('\n')) {
left = left.trim();
}
if (!options.newlineIsToken || !right.includes('\n')) {
right = right.trim();
}
}
return Diff.Diff.prototype.equals.call(this, left, right, options);
}
8 changes: 4 additions & 4 deletions types/diff/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ export class Diff {
diagonalPath: number,
): number;

equals(left: any, right: any): boolean;
equals(left: any, right: any, options: any): boolean;

removeEmpty(array: any[]): any[];

castInput(value: any): any;
castInput(value: any, options: any): any;

join(chars: string[]): string;
join(tokens: string[]): string;

tokenize(value: string): any; // return types are string or string[]
tokenize(value: string, options: any): any; // return types are string or string[]

postProcess(changes: Change[], options: any): Change[];
}
Expand Down

0 comments on commit 63252ed

Please sign in to comment.