getCIDR

Calculate the CIDR range of two IP addresses.

getCIDR(start: string, end: string): number
Parameters
start (string) the first IP address in a set
end (string) the last IP address in a set
Returns
number: the CIDR range that includes both addresses

toInt

Calculate an integer representation of an IP address.

toInt(addr: string): number
Parameters
addr (string) an IP address
Returns
number: the IP address in integer form

sort

Sort an array of IP addresses by converting them to integers.

sort(arr: Array): Array
Parameters
arr (Array) an array of IP addresses
Returns
Array: the array sorted numerically