Suggest the closest match from candidates to input, or undefined if
none is close enough. Heuristic ported from TypeScript's
getSpellingSuggestionForName (src/compiler/checker.ts):
n < 3: only a case-insensitive exact match counts
maxLenDiff: min(2, floor(0.34 * n)) reject candidates too far in length
maxDist: floor(0.4 * n) + 1 max edit distance accepted
Suggest the closest match from
candidatestoinput, or undefined if none is close enough. Heuristic ported from TypeScript'sgetSpellingSuggestionForName(src/compiler/checker.ts):Comparison is case-insensitive.