Error & Format fixing
This commit is contained in:
1 parent
ebd5a3d3a6
commit
8ed3ce8203
3 files changed
+18
-14
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user