UNPKG

@t3ned/channel

Version:

Ergonomic, chaining-based Typescript framework for quick API development for Fastify

21 lines 614 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.joinRoutePaths = void 0; /** * Join multiple route paths * @param paths The paths to join * * @returns The route path */ const joinRoutePaths = (...paths) => { const path = paths.reduce((routePath, part) => { if (!part) return routePath; if (!part.startsWith("/")) part = `/${part}`; return `${routePath}${part}`; }, ""); return (path.endsWith("/") ? path.slice(0, -1) : path); }; exports.joinRoutePaths = joinRoutePaths; //# sourceMappingURL=joinRoutePaths.js.map