UNPKG

809 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.isRouteExcluded = exports.isRequestMethodAll = void 0;
4const common_1 = require("@nestjs/common");
5const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6const isRequestMethodAll = (method) => {
7 return common_1.RequestMethod.ALL === method || method === -1;
8};
9exports.isRequestMethodAll = isRequestMethodAll;
10function isRouteExcluded(excludedRoutes, path, requestMethod) {
11 return excludedRoutes.some(route => {
12 if ((0, exports.isRequestMethodAll)(route.requestMethod) ||
13 route.requestMethod === requestMethod) {
14 return route.pathRegex.exec((0, shared_utils_1.addLeadingSlash)(path));
15 }
16 return false;
17 });
18}
19exports.isRouteExcluded = isRouteExcluded;