This commit is contained in:
Hunter Thornsberry committed 2024-09-17 12:36:49 -04:00
1 parent 3ee7a57480
commit a8ee273b24
1 file changed
+8 -1
+8 -1
View File
@@ -3,5 +3,12 @@ export function convertIntToIpAddress(int: number): string {
}
export function convertIpAddressToInt(ip: string): number | null {
return ip.split('.').reverse().reduce((ipnum, octet) => { return (ipnum<<8) + parseInt(octet)}, 0) >>> 0;
return (
ip
.split(".")
.reverse()
.reduce((ipnum, octet) => {
return (ipnum << 8) + Number.parseInt(octet);
}, 0) >>> 0
);
}