fuzzymap compare lowercase

This commit is contained in:
2021-12-15 17:56:33 -07:00
parent dcd4ad7833
commit f7d5a16e4e

View File

@@ -28,7 +28,7 @@ abstract FuzzyMap<T>(StringMap<T>) from StringMap<T> to StringMap<T> {
var bestKey = null;
for (key in this.keys()) {
var score = 1 - (key.getLevenshteinDistance(fuzzySearchKey) / Math.max(key.length, fuzzySearchKey.length));
var score = 1 - (key.toLowerCase().getLevenshteinDistance(fuzzySearchKey.toLowerCase()) / Math.max(key.length, fuzzySearchKey.length));
if (score > bestScore) {
bestScore = score;
bestKey = key;