ip-utilties 1.4.7 → 1.4.9
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 +5 -1
- package/package.json +6 -5
- package/src/ip.mjs +2 -2
package/README.md
CHANGED
|
@@ -12,12 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
ip v4/v6 utility functions
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Three different representations
|
|
16
16
|
|
|
17
17
|
```javascript
|
|
18
18
|
const ip4AsString = "10.0.0.1";
|
|
19
19
|
const ip4AsArray = new Uint8Array([10,0,0,1]);
|
|
20
20
|
const ip4or6AsBigInt = 10n << 14n | 1n;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
encodeIPv4("10.0.0.1") // -> 10n << 14n | 1n;
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
# API
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ip-utilties",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
|
+
"packageManager": "npm@11.6.0+sha512.77f3fb0dbbd881835d7bd1217deabdf7ed77fc4ec4f363df64fc3cb986404abf6c437661041080f5c5d225103508e7c9ea30cb2742b7e942675d05a10af2d7b9",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
11
|
"default": "./src/ip.mjs"
|
|
@@ -39,15 +40,15 @@
|
|
|
39
40
|
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"ava": "^6.
|
|
43
|
+
"ava": "^6.4.1",
|
|
43
44
|
"browser-ava": "^2.3.31",
|
|
44
45
|
"c8": "^10.1.3",
|
|
45
46
|
"documentation": "^14.0.3",
|
|
46
|
-
"semantic-release": "^24.2.
|
|
47
|
-
"typescript": "^5.
|
|
47
|
+
"semantic-release": "^24.2.7",
|
|
48
|
+
"typescript": "^5.9.2"
|
|
48
49
|
},
|
|
49
50
|
"engines": {
|
|
50
|
-
"node": ">=22.
|
|
51
|
+
"node": ">=22.19.0"
|
|
51
52
|
},
|
|
52
53
|
"repository": {
|
|
53
54
|
"type": "git",
|
package/src/ip.mjs
CHANGED
|
@@ -229,7 +229,7 @@ export function normalizeCIDR(address) {
|
|
|
229
229
|
prefix = _decode(ipv6, n, prefixLength);
|
|
230
230
|
if (!prefix.endsWith("::")) {
|
|
231
231
|
// TODO
|
|
232
|
-
prefix += "::";
|
|
232
|
+
prefix += prefix.endsWith(":") ? ":" : "::";
|
|
233
233
|
}
|
|
234
234
|
longPrefix = prefix;
|
|
235
235
|
} else {
|
|
@@ -309,7 +309,7 @@ export function isLinkLocal(address) {
|
|
|
309
309
|
|
|
310
310
|
export function isUniqueLocal(address) {
|
|
311
311
|
const eaddr = encodeIP(address);
|
|
312
|
-
return eaddr?.[0] ===
|
|
312
|
+
return eaddr?.[0] >> 9 === 126 ? true : false;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
export function hasWellKnownSubnet(address) {
|