UNPKG

@paroicms/server

Version:
16 lines 568 B
export function createRedirectUrl(req, entry) { const { originalUrl } = req; let mappedPath; if (entry.mapPaths) { for (const [fromRegex, toPath] of Object.entries(entry.mapPaths)) { const regex = new RegExp(fromRegex); if (regex.test(originalUrl)) { mappedPath = originalUrl.replace(regex, toPath); break; } } } const path = mappedPath ?? (entry.preservePath ? originalUrl : ""); return `${entry.to}${path}`; } //# sourceMappingURL=http-redirection-url.js.map