Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

Commit 8f8e0f2

Browse files
artemvkpdecker
authored andcommitted
refactor: simplified code a bit more
1 parent b094a6f commit 8f8e0f2

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/diff/word.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,11 @@ const reWhitespace = /\S/;
2525

2626
export const wordDiff = new Diff();
2727
wordDiff.equals = function(left, right) {
28-
if (left === right) {
29-
return true;
30-
}
31-
3228
if (this.options.ignoreCase) {
3329
left = left.toLowerCase();
3430
right = right.toLowerCase();
35-
if (left === right) {
36-
return true;
37-
}
3831
}
39-
return this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
32+
return left === right || (this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right));
4033
};
4134
wordDiff.tokenize = function(value) {
4235
let tokens = value.split(/(\s+|\b)/);

0 commit comments

Comments
 (0)