Function withinOneEdit

  • True when two words are at most one edit apart, letter by letter (a letter is a code point): the same, or one letter added, dropped or changed, or two letters side by side swapped. That is a Damerau-Levenshtein distance of 1 or less (https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance), read in one pass instead of a table. The words are compared as they are given: fold both first for a comparison that ignores case.

    Parameters

    • a: string
    • b: string

    Returns boolean