improved urlHostnameToIPv6
| @@ -693,10 +693,10 @@ export function isValidUrl(url) { | |||
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | export function urlHostnameToIPv6(hostname) { | 695 | export function urlHostnameToIPv6(hostname) { |
| 696 | if (hostname.charAt(0) === '[') { | 696 | if (hostname.startsWith("[")) { |
| 697 | hostname = hostname.slice(1); | 697 | hostname = hostname.slice(1); |
| 698 | } | 698 | } |
| 699 | if (hostname.charAt(hostname.length - 1) === ']') { | 699 | if (hostname.endsWith("]")) { |
| 700 | hostname = hostname.slice(0, -1); | 700 | hostname = hostname.slice(0, -1); |
| 701 | } | 701 | } |
| 702 | return hostname | 702 | return hostname |