Class IPv4Addr
Expand description
Constructors§
Methods§
source§netMask
netMask
source§netMask(prefixLen: string | number): IPv4Addr
netMask(prefixLen: string | number): IPv4Addr
Construct the subnet mask address corresonding to the given prefix length.
If the prefixLen parameter is not a number between 0 and 32 (inclusive),
the function will throw an error.
const mask = IPv4Addr.netMask(24);
assert(mask.toString() === '255.255.255.0');
The class represents an IPv4 address.