We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
_distance
1 parent abf2573 commit 6f73afbCopy full SHA for 6f73afb
packages/svelte/src/compiler/utils/fuzzymatch.js
@@ -26,11 +26,7 @@ function _distance(str1, str2) {
26
str1 = String(str1);
27
str2 = String(str2);
28
const distance = levenshtein(str1, str2);
29
- if (str1.length > str2.length) {
30
- return 1 - distance / str1.length;
31
- } else {
32
- return 1 - distance / str2.length;
33
- }
+ return 1 - distance / Math.max(str1.length, str2.length);
34
}
35
36
// helper functions
0 commit comments