Skip to content

Commit

Permalink
Fixed inline declared middleware &middleware in the ROUTE() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersirka committed Aug 5, 2024
1 parent c1f5adb commit c02c053
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
0.0.98
========================

- fixed inline declared middleware `&middleware` in the `ROUTE()` method

========================
0.0.97
========================
Expand Down
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3792,12 +3792,13 @@ global.ROUTE = function(url, funcExecute, flags, length, language) {
flags.push(first === '-' ? 'unauthorized' : 'authorized');
}

url = url.replace(/\s&[#0-9a-z]+/gi, function(text) {
url = url.replace(/\s&[0-9a-z]+/gi, function(text) {
!flags && (flags = []);
let f = text.trim().substring(1);
if ((/^\d+$/).test(f))
f = +f;
flags.push(f);
let flag = text.trim();
let cleaned = flag.substring(1);
if ((/^\d+$/).test(cleaned))
flag = +cleaned;
flags.push(flag);
return '';
}).trim();

Expand Down Expand Up @@ -3993,6 +3994,8 @@ global.ROUTE = function(url, funcExecute, flags, length, language) {
continue;
}

console.log(flags[i])

if (first === '#' || first === '&') {
!middleware && (middleware = []);
middleware.push(flags[i].substring(1).trim());
Expand Down

0 comments on commit c02c053

Please sign in to comment.