commited util

This commit is contained in:
BPplays
2024-12-29 04:20:39 -08:00
parent dd6dcf1c5b
commit 07cff878e5

View File

@ -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.
*/