cidr-tools 5.0.10 → 5.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ normalize('::ffff/64') //=> '::/64'
|
|
|
25
25
|
|
|
26
26
|
All functions take CIDR addresses or single IP addresses. On single addresses, a prefix of `/32` or `/128` is assumed. Function that return networks will return a merged and sorted set of networks with IPv4 sorted before IPv6.
|
|
27
27
|
|
|
28
|
+
This module requires [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#browser_compatibility) support in your environment.
|
|
29
|
+
|
|
28
30
|
### merge(networks)
|
|
29
31
|
|
|
30
32
|
- `networks` *String* or *Array*: One or more CIDR or IP addresses.
|
package/index.js
CHANGED
|
@@ -48,11 +48,11 @@ export function normalize(cidr) {
|
|
|
48
48
|
|
|
49
49
|
function parse(str) {
|
|
50
50
|
if (isCidr(str)) {
|
|
51
|
-
return new IPCIDR(
|
|
51
|
+
return new IPCIDR(str);
|
|
52
52
|
} else {
|
|
53
53
|
const version = isIP(str);
|
|
54
54
|
if (version) {
|
|
55
|
-
return new IPCIDR(
|
|
55
|
+
return new IPCIDR(`${str}/${bits[`v${version}`]}`);
|
|
56
56
|
} else {
|
|
57
57
|
throw new Error(`Network is not a CIDR or IP: ${str}`);
|
|
58
58
|
}
|