aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils.js')
-rw-r--r--lib/utils.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/utils.js b/lib/utils.js
index 1babb2ec..5bb3a6cc 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -143,16 +143,15 @@ root.utils = {
},
/**
- * Tries to convert :str into a valid URL.
- * We don't bother with escaping characters, however, as Chrome will do that for us.
+ * Converts :string into a google search if it's not already a URL.
+ * We don't bother with escaping characters as Chrome will do that for us.
*/
- ensureUrl: function(str) {
- // trim str
- str = str.replace(/^\s+|\s+$/g, '');
- if (utils.isUrl(str))
- return utils.createFullUrl(str);
+ convertToUrl: function(string) {
+ string = string.trim();
+ if (utils.isUrl(string))
+ return utils.createFullUrl(string);
else
- return utils.createSearchUrl(str);
+ return utils.createSearchUrl(string);
}
};