ip-utilties 1.4.6 → 1.4.8

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 (3) hide show
  1. package/README.md +5 -1
  2. package/package.json +6 -5
  3. package/src/ip.mjs +7 -1
package/README.md CHANGED
@@ -12,12 +12,16 @@
12
12
 
13
13
  ip v4/v6 utility functions
14
14
 
15
- ## 3 different representations
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.6",
3
+ "version": "1.4.8",
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.3.0",
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.5",
47
- "typescript": "^5.8.3"
47
+ "semantic-release": "^24.2.7",
48
+ "typescript": "^5.9.2"
48
49
  },
49
50
  "engines": {
50
- "node": ">=22.16.0"
51
+ "node": ">=22.19.0"
51
52
  },
52
53
  "repository": {
53
54
  "type": "git",
package/src/ip.mjs CHANGED
@@ -277,6 +277,12 @@ export function reverseArpa(address) {
277
277
  )
278
278
  .split("")
279
279
  .reverse()
280
+ .reduce((all, s) => {
281
+ if (all.length > 0 || s !== "0") {
282
+ all.push(s);
283
+ }
284
+ return all;
285
+ }, [])
280
286
  .join(".") + ".ip6.arpa"
281
287
  );
282
288
  }
@@ -303,7 +309,7 @@ export function isLinkLocal(address) {
303
309
 
304
310
  export function isUniqueLocal(address) {
305
311
  const eaddr = encodeIP(address);
306
- return eaddr?.[0] === 0xfc00 || eaddr?.[0] === 0xfd00;
312
+ return eaddr?.[0] >> 9 === 126 ? true : false;
307
313
  }
308
314
 
309
315
  export function hasWellKnownSubnet(address) {