commited util

07cff878e5dba997d04ffcd03a7fa06b058b232f

BPplays <andymalbp@gmail.com>

1 files changed, +17 -0Ignore whitespace
src/util.js+17 -0
@@ -692,6 +692,23 @@ export function isValidUrl(url) {
692692 }
693693}
694694
695+export function urlHostnameToIPv6(hostname) {
696+ if (hostname.charAt(0) === '[') {
697+ hostname = hostname.slice(1);
698+ }
699+ if (hostname.charAt(hostname.length - 1) === ']') {
700+ hostname = hostname.slice(0, -1);
701+ }
702+ // console.log(hostname)
703+ return hostname
704+}
705+
706+export function stringToBool(str) {
707+ if (str === 'true') return true;
708+ if (str === 'false') return false;
709+ return str;
710+}
711+
695712/**
696713 * MemoryLimitedMap class that limits the memory usage of string values.
697714 */