chore: refactor return statement in `_distance` function (#9025)

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
pull/9071/head
Михаил Туник 11 months ago committed by GitHub
parent abf257306b
commit 6f73afb497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -26,11 +26,7 @@ function _distance(str1, str2) {
str1 = String(str1);
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