KnockoutJS drop unused dontLimitMoves

This commit is contained in:
the-djmaze 2024-03-03 18:11:15 +01:00
parent acf1be454f
commit 62bda28a28
2 changed files with 1 additions and 5 deletions

View file

@ -87,7 +87,6 @@
Array.prototype.map.call(lastMappingResult, x => x.arrayEntry), Array.prototype.map.call(lastMappingResult, x => x.arrayEntry),
array, array,
{ {
'dontLimitMoves': options['dontLimitMoves'],
'sparse': true 'sparse': true
}); });
} }

View file

@ -78,16 +78,13 @@ ko.utils.compareArrays = (() => {
// Set a limit on the number of consecutive non-matching comparisons; having it a multiple of // Set a limit on the number of consecutive non-matching comparisons; having it a multiple of
// smlIndexMax keeps the time complexity of this algorithm linear. // smlIndexMax keeps the time complexity of this algorithm linear.
ko.utils.findMovesInArrayComparison(notInBig, notInSml, !options['dontLimitMoves'] && smlIndexMax * 10); ko.utils.findMovesInArrayComparison(notInBig, notInSml, smlIndexMax * 10);
return editScript.reverse(); return editScript.reverse();
}; };
// Simple calculation based on Levenshtein distance. // Simple calculation based on Levenshtein distance.
return (oldArray, newArray, options) => { return (oldArray, newArray, options) => {
// For backward compatibility, if the third arg is actually a bool, interpret
// it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }.
options = (typeof options === 'boolean') ? { 'dontLimitMoves': options } : (options || {});
oldArray = oldArray || []; oldArray = oldArray || [];
newArray = newArray || []; newArray = newArray || [];