You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because it parses the IP and CIDR separately. CIDR is used for checking through another function.
The octets stored is the one used from parsing the IP address irregardless of the existence of CIDR, thus toString will only return the parsed IP address, and if CIDR was given, then appends it afterwards.
You'll need to use the match function to test for CIDR (which only exists when using the parse function, not parseCIDR.
The parser doesn't know about any CIDR notations. It is only passed in the IP address string (without CIDR) for parsing. This is the same if you use parseCIDR, as it send everything before the slash to the parser for IP Address.
While writing tests for that other issue I ran into this one - shouldn't this pass?
assert.equal(ipaddr.IPv4.parseCIDR('8.3.4.8/24').toString(), '8.3.4.0/24');
Admittedly it's invalid input, but shouldn't we silently fix it or throw? Instead, we produce invalid output.
The text was updated successfully, but these errors were encountered: