Initial commit
This commit is contained in:
commit
b3a51a4115
10336 changed files with 2381973 additions and 0 deletions
25
node_modules/hono/dist/router/reg-exp-router/matcher.js
generated
vendored
Normal file
25
node_modules/hono/dist/router/reg-exp-router/matcher.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// src/router/reg-exp-router/matcher.ts
|
||||
import { METHOD_NAME_ALL } from "../../router.js";
|
||||
var emptyParam = [];
|
||||
function match(method, path) {
|
||||
const matchers = this.buildAllMatchers();
|
||||
const match2 = ((method2, path2) => {
|
||||
const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
|
||||
const staticMatch = matcher[2][path2];
|
||||
if (staticMatch) {
|
||||
return staticMatch;
|
||||
}
|
||||
const match3 = path2.match(matcher[0]);
|
||||
if (!match3) {
|
||||
return [[], emptyParam];
|
||||
}
|
||||
const index = match3.indexOf("", 1);
|
||||
return [matcher[1][index], match3];
|
||||
});
|
||||
this.match = match2;
|
||||
return match2(method, path);
|
||||
}
|
||||
export {
|
||||
emptyParam,
|
||||
match
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue