perf: ♻️ optimize Codec

This commit is contained in:
viarotel
2023-11-02 15:08:19 +08:00
parent 5331eb1396
commit 6154ffcfae
13 changed files with 371 additions and 71 deletions

View File

@@ -17,8 +17,12 @@ export function isIPWithPort(ip) {
return regex.test(ip)
}
export function replaceIP(value, to = '_') {
return value.replaceAll('.', to).replaceAll(':', to)
export function replaceIP(value) {
return value.replaceAll('.', '_').replaceAll(':', '-')
}
export function restoreIP(value) {
return value.replaceAll('_', '.').replaceAll('-', ':')
}
/**