Skip to content

Instantly share code, notes, and snippets.

@insightcoder
Last active October 7, 2017 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insightcoder/9f725a717874d3b4e30fd1242612c4c9 to your computer and use it in GitHub Desktop.
Save insightcoder/9f725a717874d3b4e30fd1242612c4c9 to your computer and use it in GitHub Desktop.
function lookup(search_term) {
var results = {};
search_term = search_term.trim();
var pattern = new RegExp('^' + search_term + '$', 'i');
pattern.compile(pattern);
for (var word in dictionary) {
if (pattern.test(word)) {
results[word] = dictionary[word];
}
}
var html = render_results(search_term, results);
$('#results').html(html);
}
function submit_lookup() {
var lookup_obj = $("#lookup");
var search_term = lookup_obj.val();
lookup(search_term);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment