Skip to content

Commit

Permalink
Simplifying ops in keymaster()
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Jul 25, 2018
1 parent ae8b0e5 commit d8ae8d6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ function keymaster (req, res) {
}
} else {
retsu.each(Array.from(routes.keys()), i => {
let key = i;

if (regex.hasParam.test(i) === true && regex.leftBrace.test(i) === false) {
key = i.replace(/\/:(\w*)/g, "/(.*)");
}
const key = regex.hasParam.test(i) === true && regex.leftBrace.test(i) === false ? i.replace(/\/:(\w*)/g, "/(.*)") : i;

if (new RegExp(`^${key}$`, "i").test(uri) === true) {
return !(result = routes.get(i)[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 elastic REST API gateway for node.js",
"version": "8.0.14",
"version": "8.0.15",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit d8ae8d6

Please sign in to comment.