12 lines
273 B
TypeScript
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
|
|
}
|