Skip to content

Commit 5f8d8cb

Browse files
Link-the-elfbenmccann
authored andcommitted
chore: refactor return statement in _distance function (sveltejs#9025)
Co-authored-by: Ben McCann <[email protected]>
1 parent d621085 commit 5f8d8cb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

packages/svelte/src/compiler/utils/fuzzymatch.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ function _distance(str1, str2) {
2626
str1 = String(str1);
2727
str2 = String(str2);
2828
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-
}
29+
return 1 - distance / Math.max(str1.length, str2.length);
3430
}
3531

3632
// helper functions

0 commit comments

Comments
 (0)