cidr-tools 7.0.7 → 8.0.0
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 +0 -2
- package/index.d.ts +0 -1
- package/index.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,8 +79,6 @@ Returns a `parsed` Object which is used internally by this module. It can be use
|
|
|
79
79
|
- `prefix` String: The network prefix, e.g. `/64`.
|
|
80
80
|
- `start` BigInt: Start number of the network.
|
|
81
81
|
- `end` BigInt: End number of the network.
|
|
82
|
-
- `end` BigInt: Start of the network.
|
|
83
|
-
- `single` Boolean: `true` when the network is a single IP.
|
|
84
82
|
|
|
85
83
|
## Related
|
|
86
84
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -16,8 +16,8 @@ function compare(a, b) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function doNormalize(cidr, {compress = true, hexify = false} = {}) {
|
|
19
|
-
const {start,
|
|
20
|
-
if (
|
|
19
|
+
const {start, end, prefix, version} = parse(cidr);
|
|
20
|
+
if (start !== end) { // cidr
|
|
21
21
|
// set network address to first address
|
|
22
22
|
const ip = normalizeIp(stringifyIp({number: start, version}), {compress, hexify});
|
|
23
23
|
return `${ip}/${prefix}`;
|
|
@@ -58,7 +58,6 @@ export function parse(str) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
parsed.prefix = prefix;
|
|
61
|
-
parsed.single = prefix === String(bits[parsed.version]);
|
|
62
61
|
const {number, version} = parseIp(ip);
|
|
63
62
|
const numBits = bits[version];
|
|
64
63
|
const ipBits = number.toString(2).padStart(numBits, "0");
|