···1313 }
14141515 const distance = leven(longer, shorter);
1616- const diff = (distance / longer.length) * 100;
1616+ // use the shorter length
1717+ // because if we have more move/change operations than the length of the shortest string than we have two unique strings
1818+ // and if we use the longer length the score actually gets *better* as the length gap gets larger (not what we want)
1919+ // -- cap at 100% diff
2020+ const diff = Math.min((distance / shorter.length) * 100, 100);
1721 return [distance, 100 - diff];
1822}
1923