1234567891011121314151617181920212223242526 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getMiddlewareRouteMatcher = getMiddlewareRouteMatcher;
- var _prepareDestination = require("./prepare-destination");
- function getMiddlewareRouteMatcher(matchers) {
- return (pathname, req, query)=>{
- for (const matcher of matchers){
- const routeMatch = new RegExp(matcher.regexp).exec(pathname);
- if (!routeMatch) {
- continue;
- }
- if (matcher.has || matcher.missing) {
- const hasParams = (0, _prepareDestination).matchHas(req, query, matcher.has, matcher.missing);
- if (!hasParams) {
- continue;
- }
- }
- return true;
- }
- return false;
- };
- }
- //# sourceMappingURL=middleware-route-matcher.js.map
|