-
Notifications
You must be signed in to change notification settings - Fork 0
/
IPAddress.ts
31 lines (29 loc) · 1.26 KB
/
IPAddress.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export function ipsBetween(start: string, end: string): number {
// Helper function to convert an IP address to its integer representation
function ipToInt(ip: string): number {
return ip.split('.').reduce((acc, octet) => acc * 256 + parseInt(octet, 10), 0);
}
const startInt = ipToInt(start);
const endInt = ipToInt(end);
return endInt - startInt;
}
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');
console.log('Auto-update for IPAddress.ts');