Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let address;
try {
address = new Address(search);
} catch (e) {
//Do nothing.
}
if (address) {
if (address.isValid()) {
let result = { type: "Address", url: `/address/${search}` };
results.push(result);
}
}
if (rules.verifyString(search)) {
let result = { type: "Name", url: `/name/${search}` };
results.push(result);
}
if (results.length === 1) {
//return the url
return h.redirect(results[0].url);
}
return h.view("search.pug", { results });
}