Skip to content

Commit

Permalink
Reducing verbose code
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Apr 21, 2019
1 parent 5e973b7 commit a84b967
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,9 @@ function keymaster (req, res) {
}
} else {
retsu.each(Array.from(routes.keys()), i => {
const key = regex.hasParam.test(i) && regex.leftBrace.test(i) === false ? i.replace(/\/:(\w*)/g, "/(.*)") : i;
const key = i.contains(":") && i.contains("(") === false ? i.replace(/\/:(\w*)/g, "/(.*)") : i;

if (new RegExp(`^${key}$`, "i").test(uri)) {
return !(result = routes.get(i)[0]);
}

return void 0;
return new RegExp(`^${key}$`, "i").test(uri) ? !(result = routes.get(i)[0]) : void 0;
});

if (result !== void 0) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is an HTTP/HTTP2 REST API framework",
"version": "11.0.0",
"version": "11.0.1",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit a84b967

Please sign in to comment.