Files
web/utils/url.ts
2024-07-01 10:24:22 +02:00

12 lines
273 B
TypeScript

export function removeMultipleSlashes(str: string) {
return str.replaceAll(/\/\/+/g, "/")
}
export function removeTrailingSlash(pathname: string) {
if (pathname.endsWith("/")) {
// Remove the trailing slash
return pathname.slice(0, -1)
}
return pathname
}