diff --git a/fetch.js b/fetch.js index e3df975..f3bc9fa 100644 --- a/fetch.js +++ b/fetch.js @@ -70,7 +70,9 @@ function fetch() { } function parse(str) { - return String(str).match(/\w+/).map(function(word){ + str = String(str).trim(); + if (!str) return []; + return str.match(/\w+/).map(function(word){ return word.toLowerCase(); }); }