ip-utilties 1.3.0 → 1.3.1
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/package.json +3 -3
- package/src/ip.mjs +4 -6
- package/types/ip.d.mts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ip-utilties",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
},
|
|
13
13
|
"description": "ip v4/v6 utility functions",
|
|
14
14
|
"keywords": [
|
|
15
|
+
"cidr",
|
|
15
16
|
"ip",
|
|
16
17
|
"ipv4",
|
|
17
18
|
"ipv6",
|
|
18
19
|
"network",
|
|
19
|
-
"subnet"
|
|
20
|
-
"cidr"
|
|
20
|
+
"subnet"
|
|
21
21
|
],
|
|
22
22
|
"contributors": [
|
|
23
23
|
{
|
package/src/ip.mjs
CHANGED
|
@@ -223,14 +223,14 @@ export function normalizeCIDR(address) {
|
|
|
223
223
|
let [prefix, prefixLength] = address.split(/\//);
|
|
224
224
|
let longPrefix;
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
prefixLength = prefixLength === undefined ? 0 : parseInt(prefixLength);
|
|
227
|
+
|
|
228
|
+
if (isLinkLocal(address)) {
|
|
227
229
|
prefix = "fe80::";
|
|
228
230
|
longPrefix = prefix;
|
|
229
231
|
prefixLength = 64;
|
|
230
232
|
} else {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const family = isIPv6(prefix) ? ipv6 : ipv4;
|
|
233
|
+
const family = /*_family(prefix); */ isIPv6(prefix) ? ipv6 : ipv4;
|
|
234
234
|
let n;
|
|
235
235
|
|
|
236
236
|
if (prefixLength) {
|
|
@@ -240,8 +240,6 @@ export function normalizeCIDR(address) {
|
|
|
240
240
|
|
|
241
241
|
if (isLocalhost(n)) {
|
|
242
242
|
prefixLength = family === ipv6 ? 128 : 8;
|
|
243
|
-
} else {
|
|
244
|
-
return {};
|
|
245
243
|
}
|
|
246
244
|
}
|
|
247
245
|
prefix = _decode(family, n, prefixLength);
|
package/types/ip.d.mts
CHANGED
|
@@ -17,11 +17,6 @@ export function prefixIP(address: any, length: any): string;
|
|
|
17
17
|
export function rangeIP(address: any, prefix: any, lowerAdd?: number, upperReduce?: number): any[];
|
|
18
18
|
export function matchPrefixIP(prefix: any, length: any, address: any): boolean;
|
|
19
19
|
export function normalizeCIDR(address: any): {
|
|
20
|
-
longPrefix?: undefined;
|
|
21
|
-
prefix?: undefined;
|
|
22
|
-
prefixLength?: undefined;
|
|
23
|
-
cidr?: undefined;
|
|
24
|
-
} | {
|
|
25
20
|
longPrefix: any;
|
|
26
21
|
prefix: any;
|
|
27
22
|
prefixLength: any;
|