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
|
||||
// and does not pass the bounds of the diff graph
|
||||
if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
|
||||
basePath = clonePath(removePath);
|
||||
basePath = this._clonePath(removePath);
|
||||
self.pushComponent(basePath.components, undefined, true);
|
||||
} else {
|
||||
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 (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 {
|
||||
// Otherwise track this path as a potential candidate and continue.
|
||||
bestPath[diagonalPath] = basePath;
|
||||
|
@ -132,14 +132,14 @@ Diff.prototype = {
|
|||
return callback();
|
||||
}
|
||||
|
||||
if (!execEditLength()) {
|
||||
if (!execEditLength.call(this)) {
|
||||
exec();
|
||||
}
|
||||
}, 0);
|
||||
}());
|
||||
} else {
|
||||
while (editLength <= maxEditLength) {
|
||||
let ret = execEditLength();
|
||||
let ret = execEditLength.call(this);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -197,10 +197,9 @@ Diff.prototype = {
|
|||
},
|
||||
join(value) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
function buildValues(diff, components, newString, oldString, useLongestToken) {
|
||||
_buildValues(diff, components, newString, oldString, useLongestToken) {
|
||||
let componentPos = 0,
|
||||
componentLen = components.length,
|
||||
newPos = 0,
|
||||
|
@ -254,8 +253,9 @@ function buildValues(diff, components, newString, oldString, useLongestToken) {
|
|||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
},
|
||||
|
||||
function clonePath(path) {
|
||||
_clonePath(path) {
|
||||
return { newPos: path.newPos, components: path.components.slice(0) };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue