diff --git a/src/util.js b/src/util.js index 13176f46e..1bd870ea1 100644 --- a/src/util.js +++ b/src/util.js @@ -692,6 +692,23 @@ export function isValidUrl(url) { } } +export function urlHostnameToIPv6(hostname) { + if (hostname.charAt(0) === '[') { + hostname = hostname.slice(1); + } + if (hostname.charAt(hostname.length - 1) === ']') { + hostname = hostname.slice(0, -1); + } + // console.log(hostname) + return hostname +} + +export function stringToBool(str) { + if (str === 'true') return true; + if (str === 'false') return false; + return str; +} + /** * MemoryLimitedMap class that limits the memory usage of string values. */