formatURL()function
formatURL(url: PossibleURL, base?: PossibleURL, caller: AnyCaller = formatURL): string
| Param | Type | |
|---|---|---|
url | PossibleURL | URL to format. required |
base | PossibleURL | Base URL to resolve url against if it is relative. |
caller | AnyCaller |
| Return | |
|---|---|
string | Friendly string showing the host and path with any trailing slash removed. |
| Throws | |
|---|---|
RequiredError | If url cannot be converted to a valid URL. |
Format a URL as a user-friendly string.
- e.g.
http://shax.com/test?uid=129483→shax.com/test
Examples
formatURL("http://shax.com/test?uid=129483") // "shax.com/test"