ip-utilties 3.5.3 → 3.6.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/package.json +2 -2
- package/src/ip.mjs +5 -0
- package/types/ip.d.mts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ip-utilties",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"browser-ava": "^2.3.66",
|
|
45
45
|
"c8": "^11.0.0",
|
|
46
46
|
"documentation": "^14.0.3",
|
|
47
|
-
"semantic-release": "^25.0.
|
|
47
|
+
"semantic-release": "^25.0.6",
|
|
48
48
|
"typescript": "^7.0.2"
|
|
49
49
|
},
|
|
50
50
|
"overrides": {
|
package/src/ip.mjs
CHANGED
|
@@ -250,6 +250,11 @@ export function prefixIP(address, length) {
|
|
|
250
250
|
return _decode(family, _prefix(family, address, length));
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
export function prefixOnlyIP(address, length) {
|
|
254
|
+
const family = _family(address);
|
|
255
|
+
return _decode(family, _prefix(family, address, length), length);
|
|
256
|
+
}
|
|
257
|
+
|
|
253
258
|
function _prefix(family, address, length) {
|
|
254
259
|
return (
|
|
255
260
|
_asBigInt(family, address) & (-1n << BigInt(family.bitLength - length))
|
package/types/ip.d.mts
CHANGED
|
@@ -37,6 +37,7 @@ export declare function isIPv6(address: any): boolean;
|
|
|
37
37
|
export declare function familyIP(address: string | Uint8Array | Uint16Array): string | undefined;
|
|
38
38
|
export declare function asBigInt(address: any): any;
|
|
39
39
|
export declare function prefixIP(address: any, length: any): string;
|
|
40
|
+
export declare function prefixOnlyIP(address: any, length: any): string;
|
|
40
41
|
export declare function rangeIP(address: any, prefix: any, lowerAdd?: number, upperReduce?: number): any[];
|
|
41
42
|
export declare function matchPrefixIP(prefix: any, length: any, address: any): boolean;
|
|
42
43
|
export declare function normalizeCIDR(address: any): {
|