Last active
October 7, 2017 03:48
-
-
Save insightcoder/9f725a717874d3b4e30fd1242612c4c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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