Perf/Refactor: faster ip version

This commit is contained in:
SukkaW
2025-01-22 20:04:41 +08:00
parent 07419a7942
commit e19d7989c3
6 changed files with 37 additions and 24 deletions

View File

@@ -69,3 +69,7 @@ export function isDirectoryEmptySync(path: PathLike) {
directoryHandle.closeSync();
}
}
export function fastIpVersion(ip: string) {
return ip.includes(':') ? 6 : (ip.includes('.') ? 4 : 0);
}