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 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
@@ -11,7 +11,6 @@ type Parsed = {
11
11
  prefix: string;
12
12
  start: bigint;
13
13
  end: bigint;
14
- single: boolean;
15
14
  };
16
15
 
17
16
  type NormalizeOpts = {
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, prefix, single, version} = parse(cidr);
20
- if (!single) { // cidr
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cidr-tools",
3
- "version": "7.0.7",
3
+ "version": "8.0.0",
4
4
  "author": "silverwind <me@silverwind.io>",
5
5
  "description": "Tools to work with IPv4 and IPv6 CIDR",
6
6
  "repository": "silverwind/cidr-tools",