Enclose implementations under a namespace
This commit is contained in:
parent
c72146a554
commit
5d152e3599
1 changed files with 57 additions and 57 deletions
|
@ -98,7 +98,7 @@ Diff.prototype = {
|
||||||
// path whose position in the new string is the farthest from the origin
|
// path whose position in the new string is the farthest from the origin
|
||||||
// and does not pass the bounds of the diff graph
|
// and does not pass the bounds of the diff graph
|
||||||
if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
|
if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
|
||||||
basePath = clonePath(removePath);
|
basePath = this._clonePath(removePath);
|
||||||
self.pushComponent(basePath.components, undefined, true);
|
self.pushComponent(basePath.components, undefined, true);
|
||||||
} else {
|
} else {
|
||||||
basePath = addPath; // No need to clone, we've pulled it from the list
|
basePath = addPath; // No need to clone, we've pulled it from the list
|
||||||
|
@ -110,7 +110,7 @@ Diff.prototype = {
|
||||||
|
|
||||||
// If we have hit the end of both strings, then we are done
|
// If we have hit the end of both strings, then we are done
|
||||||
if (basePath.newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
if (basePath.newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
||||||
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
|
return done(this._buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
|
||||||
} else {
|
} else {
|
||||||
// Otherwise track this path as a potential candidate and continue.
|
// Otherwise track this path as a potential candidate and continue.
|
||||||
bestPath[diagonalPath] = basePath;
|
bestPath[diagonalPath] = basePath;
|
||||||
|
@ -132,14 +132,14 @@ Diff.prototype = {
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!execEditLength()) {
|
if (!execEditLength.call(this)) {
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}());
|
}());
|
||||||
} else {
|
} else {
|
||||||
while (editLength <= maxEditLength) {
|
while (editLength <= maxEditLength) {
|
||||||
let ret = execEditLength();
|
let ret = execEditLength.call(this);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -197,10 +197,9 @@ Diff.prototype = {
|
||||||
},
|
},
|
||||||
join(value) {
|
join(value) {
|
||||||
return value;
|
return value;
|
||||||
}
|
},
|
||||||
};
|
|
||||||
|
|
||||||
function buildValues(diff, components, newString, oldString, useLongestToken) {
|
_buildValues(diff, components, newString, oldString, useLongestToken) {
|
||||||
let componentPos = 0,
|
let componentPos = 0,
|
||||||
componentLen = components.length,
|
componentLen = components.length,
|
||||||
newPos = 0,
|
newPos = 0,
|
||||||
|
@ -254,8 +253,9 @@ function buildValues(diff, components, newString, oldString, useLongestToken) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return components;
|
return components;
|
||||||
}
|
},
|
||||||
|
|
||||||
function clonePath(path) {
|
_clonePath(path) {
|
||||||
return { newPos: path.newPos, components: path.components.slice(0) };
|
return { newPos: path.newPos, components: path.components.slice(0) };
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue