DidYouMean takes a query and returns similar words based on a dictionary of words that you feed it.
Take a look at the demo
var dym = new DidYouMean(['hello', 'goodbye']);
var suggestions = dym.query('helo'); // this returns ['hello']
A BK-Tree is created with your dictionary words as nodes. When queried, it uses Levenshtein Distance to compare how similar your query is to the words in the tree. If a word is within a certain edit distance threshold (default: 2), it's returned as a suggestion.