_distance return refactor (#9796)

Co-authored-by: Mike <prince-poley@yandex.ru>
pull/10326/head
Mike Tunik 7 months ago committed by GitHub
parent d31ccf3be3
commit 336d0160da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -33,11 +33,7 @@ function _distance(str1, str2) {
str2 = String(str2);
const distance = levenshtein(str1, str2);
if (str1.length > str2.length) {
return 1 - distance / str1.length;
} else {
return 1 - distance / str2.length;
}
return 1 - distance / Math.max(str1.length, str2.length);
}
// helper functions

Loading…
Cancel
Save