@@ -2,6 +2,7 @@ import { type BufferLike } from './polyfill.ts';
22export type { BufferLike } from './polyfill.ts' ;
33export type Special = 'loopback' | 'private' | 'linklocal' | 'multicast' | 'documentation' | 'reserved' | 'unspecified' ;
44type Family = 4 | 6 ;
5+ export type FamilyAlias = Family | '4' | '6' | 'ipv4' | 'ipv6' | 'IPV4' | 'IPV6' | 'IpV4' | 'IpV6' ;
56type Raw = string | number | bigint | BufferLike | Array < number > | Address ;
67type Subnet = {
78 family : Family ;
@@ -21,7 +22,7 @@ export declare class Address {
2122 big : bigint ;
2223 toBuffer ( buff ?: BufferLike , offset ?: number ) : BufferLike ;
2324 toArray ( ) : number [ ] ;
24- toString ( family ?: Family | string | number , mapped ?: boolean ) : string ;
25+ toString ( family ?: FamilyAlias , mapped ?: boolean ) : string ;
2526 toLong ( ) : number ;
2627 get range ( ) : Special | undefined ;
2728 private static create ;
@@ -33,7 +34,7 @@ export declare class Address {
3334 static not ( addr : Raw ) : string ;
3435 static or ( addrA : Raw , addrB : Raw ) : string ;
3536 static isEqual ( addrA : Raw , addrB : Raw ) : boolean ;
36- static fromPrefixLen : ( prefixlen : number | `${number } ` | string , family ?: string | number ) => Address ;
37+ static fromPrefixLen : ( prefixlen : number | `${number } ` | string , family ?: FamilyAlias ) => Address ;
3738 private static fromNumber ;
3839 private static fromLong ;
3940 private static fromBuffer ;
@@ -55,7 +56,7 @@ export declare const not: typeof Address['not'];
5556export declare const or : typeof Address [ 'or' ] ;
5657export declare const cidr : typeof Address [ 'cidr' ] ;
5758export declare const normalizeToLong : typeof Address [ 'normalizeToLong' ] ;
58- export declare function fromPrefixLen ( prefixlen : number , family ?: string | number ) : string ;
59+ export declare function fromPrefixLen ( prefixlen : number , family ?: FamilyAlias ) : string ;
5960type LegacySubnet = Omit < Subnet , 'numHosts' | 'length' > & {
6061 numHosts : number | bigint ;
6162 length : number | bigint ;
@@ -73,4 +74,4 @@ export declare const isIPv4: Checker;
7374export declare const isIPv6 : Checker ;
7475export declare const isIP : ( addr : string ) => 0 | Family ;
7576export declare function isLoopback ( addr : Raw ) : boolean ;
76- export declare function loopback ( family ?: string | number ) : string ;
77+ export declare function loopback ( family ?: FamilyAlias ) : string ;
0 commit comments