10 lines
319 B
TypeScript
10 lines
319 B
TypeScript
/**
|
|
* Makes sure that a URL has the correct number of slashes, while maintaining the
|
|
* http(s):// double slashes.
|
|
* @param url The URL to test and remove any extra double slashes.
|
|
* @return The updated url.
|
|
*/
|
|
export function checkSlashesInUrl(url: string) {
|
|
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
|
|
}
|