diff --git a/README.md b/README.md index 6876a3b..f57725b 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ addr.octets // => [192, 168, 1, 1] ``` `prefixLengthFromSubnetMask()` will return a CIDR prefix length for a valid IPv4 netmask or -false if the netmask is not valid. +null if the netmask is not valid. ```js ipaddr.IPv4.parse('255.255.255.240').prefixLengthFromSubnetMask() == 28 diff --git a/lib/ipaddr.js.d.ts b/lib/ipaddr.js.d.ts index ef01ac4..52174b6 100644 --- a/lib/ipaddr.js.d.ts +++ b/lib/ipaddr.js.d.ts @@ -1,7 +1,4 @@ - - declare module "ipaddr.js" { - type IPv4Range = 'unicast' | 'unspecified' | 'broadcast' | 'multicast' | 'linkLocal' | 'loopback' | 'carrierGradeNat' | 'private' | 'reserved'; type IPv6Range = 'unicast' | 'unspecified' | 'linkLocal' | 'multicast' | 'loopback' | 'uniqueLocal' | 'ipv4Mapped' | 'rfc6145' | 'rfc6052' | '6to4' | 'teredo' | 'reserved'; @@ -9,23 +6,20 @@ declare module "ipaddr.js" { [name: string]: [T, number] | [T, number][]; } - // Common methods/properties for IPv4 and IPv6 classes. class IP { - - prefixLengthFromSubnetMask(): number | false; + prefixLengthFromSubnetMask(): number | null; toByteArray(): number[]; toNormalizedString(): string; toString(): string; } namespace Address { - export function isValid(addr: string): boolean; export function fromByteArray(bytes: number[]): IPv4 | IPv6; export function parse(addr: string): IPv4 | IPv6; export function parseCIDR(mask: string): [IPv4 | IPv6, number]; - export function process(address: string): IPv4 | IPv6; + export function process(addr: string): IPv4 | IPv6; export function subnetMatch(addr: IPv4, rangeList: RangeList, defaultName?: string): string; export function subnetMatch(addr: IPv6, rangeList: RangeList, defaultName?: string): string; @@ -39,6 +33,7 @@ declare module "ipaddr.js" { static parseCIDR(addr: string): [IPv4, number]; static subnetMaskFromPrefixLength(prefix: number): IPv4; constructor(octets: number[]); + octets: number[] kind(): 'ipv4'; match(addr: IPv4, bits: number): boolean; @@ -55,7 +50,9 @@ declare module "ipaddr.js" { static parse(addr: string): IPv6; static parseCIDR(addr: string): [IPv6, number]; static subnetMaskFromPrefixLength(prefix: number): IPv6; - constructor(octets: number[]); + constructor(parts: number[]); + parts: number[] + zoneId?: string isIPv4MappedAddress(): boolean; kind(): 'ipv6'; diff --git a/package.json b/package.json index 7e092f1..1e07cce 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "dependencies": {}, "devDependencies": { "coffee-script": "~1.12.6", - "uglify-js": "~3.0.19", - "nodeunit": ">=0.8.2 <0.8.7" + "nodeunit": "^0.11.3", + "uglify-js": "~3.0.19" }, "scripts": { "test": "cake build test"