getBaseURL()function
getBaseURL(input: Nullish<PossibleURL>): BaseURL | undefined
| Param | Type | |
|---|---|---|
input | Nullish<PossibleURL> | URL string, URL object, or path to normalise. required |
| Return | |
|---|---|
BaseURL | undefined |
Get a Base URL — a true URL whose pathname is normalised to end in a trailing slash.
- Falsy or non-URL input returns
undefined. - A URL without a trailing slash is cloned and given one (the input is never mutated).
Examples
getBaseURL("http://x.com/a"); // `http://x.com/a/`