ip-utilties 1.4.5 → 1.4.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/ip.mjs +6 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ip-utilties",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
package/src/ip.mjs CHANGED
@@ -223,21 +223,18 @@ export function normalizeCIDR(address) {
223
223
  let [prefix, prefixLength] = address.split(/\//);
224
224
  let longPrefix;
225
225
 
226
- prefixLength = prefixLength === undefined ? 0 : parseInt(prefixLength);
227
-
228
- if (isLinkLocal(address)) {
229
- prefix = "fe80::";
230
- longPrefix = prefix;
231
- prefixLength = 64;
232
- } else if (isUniqueLocal(address)) {
226
+ if (isUniqueLocal(address) || isLinkLocal(address)) {
233
227
  prefixLength = 64;
234
228
  const n = _prefix(ipv6, address, prefixLength);
235
229
  prefix = _decode(ipv6, n, prefixLength);
236
- if(!prefix.endsWith('::')) { // TODO
237
- prefix += '::';
230
+ if (!prefix.endsWith("::")) {
231
+ // TODO
232
+ prefix += "::";
238
233
  }
239
234
  longPrefix = prefix;
240
235
  } else {
236
+ prefixLength = prefixLength === undefined ? 0 : parseInt(prefixLength);
237
+
241
238
  const family = /*_family(prefix); */ isIPv6(prefix) ? ipv6 : ipv4;
242
239
  let n;
243
240