22 lines
695 B
Plaintext
22 lines
695 B
Plaintext
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
require("../../router.js");
|
|
//#region src/router/reg-exp-router/matcher.ts
|
|
const emptyParam = [];
|
|
function match(method, path) {
|
|
const matchers = this.buildAllMatchers();
|
|
const match = ((method, path) => {
|
|
const matcher = matchers[method] || matchers["ALL"];
|
|
const staticMatch = matcher[2][path];
|
|
if (staticMatch) return staticMatch;
|
|
const match = path.match(matcher[0]);
|
|
if (!match) return [[], emptyParam];
|
|
const index = match.indexOf("", 1);
|
|
return [matcher[1][index], match];
|
|
});
|
|
this.match = match;
|
|
return match(method, path);
|
|
}
|
|
//#endregion
|
|
exports.emptyParam = emptyParam;
|
|
exports.match = match;
|