Error & Format fixing

This commit is contained in:
Tilen Komel
2024-08-21 23:13:35 +02:00
parent ebd5a3d3a6
commit 8ed3ce8203
3 changed files with 18 additions and 14 deletions
+3 -3
View File
@@ -3,11 +3,11 @@ export function convertIntToIpAddress(int: number): string {
}
export function convertIpAddressToInt(ip: string): number | null {
const parts = ip.split('.').map(Number).reverse(); // little-endian byte order
const parts = ip.split(".").map(Number).reverse(); // little-endian byte order
if (parts.some(Number.isNaN)) {
return null;
return null;
}
return parts.reduce((total, part) => (total << 8) | part, 0);
}
}