javascript implementation of the Levenshtein distance algorithm