blob: 8596d899b59b447cb0a4a422388e907fbedd7928 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
/**
* Removes the protcol, host and port from a URL, returning
* just the path and search portions
*
* This is useful for taking a URL that points to the production site
* and removing anything specific to the location that it is deployed,
* creating a partial URL that works both locally or when deployed
*/
export function stripHost(input: string): string {
const url = new URL(input);
return url.pathname + url.search;
}
|