Skip to content
Snippets Groups Projects
Commit 8acbea70 authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[search addon] Simplify control flow

parent f689a9e9
No related branches found
No related tags found
Loading
......@@ -63,16 +63,11 @@
function parseQuery(query) {
var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
if (isRE) {
try {
query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i");
} catch (ex) {
// Not a regular expression after all, do a string search
return query;
}
if (query.test("")) query = /x^/;
} else if (query == "") {
query = /x^/;
try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); }
catch(e) {} // Not a regular expression after all, do a string search
}
if (typeof query == "string" ? query == "" : query.test(""))
query = /x^/;
return query;
}
var queryDialog =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment