UNPKG

@vulcan-sql/build

Version:

VulcanSQL package for building projects

26 lines 994 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenerateUrl = void 0; const tslib_1 = require("tslib"); const middleware_1 = require("./middleware"); class GenerateUrl extends middleware_1.SchemaParserMiddleware { handle(schemas, next) { return tslib_1.__awaiter(this, void 0, void 0, function* () { if (schemas.urlPath) return next(); let urlPath = schemas.sourceName.toLocaleLowerCase(); // replace spaces with dashes urlPath = urlPath.replace(/\s/g, '-'); // add leading slash if (urlPath.charAt(0) !== '/') urlPath = `/${urlPath}`; // remove trailing slash if (urlPath.charAt(urlPath.length - 1) === '/') urlPath = urlPath.slice(0, -1); schemas.urlPath = urlPath; return next(); }); } } exports.GenerateUrl = GenerateUrl; //# sourceMappingURL=generateUrl.js.map