mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
commited util
This commit is contained in:
17
src/util.js
17
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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user