File size: 300 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * Cleans a URL by stripping the protocol, host, and search params.
 *
 * @param urlString the url to clean
 * @returns the cleaned url
 */

export function cleanURL(url: string | URL): URL {
  const u = new URL(url)
  u.host = 'localhost:3000'
  u.search = ''
  u.protocol = 'http'
  return u
}