chore: 补充单元测试

This commit is contained in:
xiaojunnuo
2026-05-01 09:16:46 +08:00
parent 80092823db
commit 0a0f1e90e1
24 changed files with 656 additions and 187 deletions
+4 -1
View File
@@ -51,7 +51,10 @@ function isIpv4(d: string) {
return false;
}
const isIPv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/;
return isIPv4Regex.test(d);
if (!isIPv4Regex.test(d)) {
return false;
}
return d.split(".").every(item => Number(item) <= 255);
}
function isIpv6(d: string) {