Skip to content

Commit

Permalink
Cleanup whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdecker committed Oct 20, 2012
1 parent 6209298 commit 54a326b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions diff.js
Expand Up @@ -37,7 +37,6 @@ var JsDiff = (function() {
return n;
}


var fbDiff = function(ignoreWhitespace) {
this.ignoreWhitespace = ignoreWhitespace;
};
Expand Down Expand Up @@ -127,7 +126,7 @@ var JsDiff = (function() {
while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
newPos++;
oldPos++;

this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
}
basePath.newPos = newPos;
Expand All @@ -149,24 +148,24 @@ var JsDiff = (function() {
return value;
}
};

var CharDiff = new fbDiff();

var WordDiff = new fbDiff(true);
WordDiff.tokenize = function(value) {
return removeEmpty(value.split(/(\s+|\b)/));
};

var CssDiff = new fbDiff(true);
CssDiff.tokenize = function(value) {
return removeEmpty(value.split(/([{}:;,]|\s+)/));
};

var LineDiff = new fbDiff();
LineDiff.tokenize = function(value) {
return value.split(/^/m);
};

return {
diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
Expand Down Expand Up @@ -214,7 +213,7 @@ var JsDiff = (function() {
var prev = diff[i-1];
oldRangeStart = oldLine;
newRangeStart = newLine;

if (prev) {
curRange = contextLines(prev.lines.slice(-4));
oldRangeStart -= curRange.length;
Expand Down

0 comments on commit 54a326b

Please sign in to comment.