node-cidr
node-cidr is a Javascript library that makes it easy to manipulate IPs and Subnets. Currently only IPv4 is supported, but IPv6 support is planned for a future release.Index
Variables
Functions
- address
- broadcast
- cidrCommonCidr
- count
- includes
- intCommonCidr
- ipCommonCidr
- ips
- mask
- max
- min
- netmask
- next
- nextCidr
- padLeft
- previous
- previousCidr
- random
- reverse
- subnets
- toBinary
- toCidr
- toHex
- toInt
- toIntRange
- toOctets
- toRange
- toString
- usable
- validateCidr
- validateIp
- wildcardmask
Object literals
Variables
«Const» invalidChars
● invalidChars:RegExp
= /^.?(?=\^#%&$\*:<>\?\/\{\|\}a-zA-Z).$/Defined in index.ts:3
Functions
«Const» address
► address(ip:string
): string
Defined in index.ts:155
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
| - |Returns:
string
«Const» broadcast
► broadcast(cidr:string
): string
Defined in index.ts:175
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» cidrCommonCidr
► cidrCommonCidr(cidrs:string
): string
Defined in index.ts:166
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidrs |
string
| - |Returns:
string
«Const» count
► count(cidr:string
): number
Defined in index.ts:190
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
number
«Const» includes
► includes(cidr:string
, ip: string
): boolean
Defined in index.ts:240
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |
| ip | string
| - |Returns:
boolean
«Const» intCommonCidr
► intCommonCidr(ips:number
): string
Defined in index.ts:5
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ips |
number
| - |Returns:
string
«Const» ipCommonCidr
► ipCommonCidr(ips:string
): string
Defined in index.ts:57
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ips |
string
| - |Returns:
string
«Const» ips
► ips(cidr:string
): string
Defined in index.ts:229
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» mask
► mask(ip:string
): number
Defined in index.ts:157
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
| - |Returns:
number
«Const» max
► max(cidr:string
): string
Defined in index.ts:184
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» min
► min(cidr:string
): string
Defined in index.ts:177
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» netmask
► netmask(cidr:string
): string
Defined in index.ts:172
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» next
► next(ip:string
): string
Defined in index.ts:111
Returns the next adjacent address.
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
| - |Returns:
string
«Const» nextCidr
► nextCidr(cidr:string
): string
Defined in index.ts:245
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» padLeft
► padLeft(input:string
, char: string
, min: number
): string
Defined in index.ts:26
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | input |
string
| - |
| char | string
| - |
| min | number
| - |Returns:
string
«Const» previous
► previous(ip:string
): string
Defined in index.ts:117
Returns the previous adjacent address.
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
| - |Returns:
string
«Const» previousCidr
► previousCidr(cidr:string
): string
Defined in index.ts:248
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» random
► random(cidr:string
): string
Defined in index.ts:251
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» reverse
► reverse(ip:string
⎮number
): string
Defined in index.ts:73
Returns the reverse lookup hostname for the address.
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
⎮number
| - |Returns:
string
«Const» subnets
► subnets(cidr:string
, subMask: number
, limit: number
): string
Defined in index.ts:206
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |
| subMask | number
| - |
| limit | number
| - |Returns:
string
«Const» toBinary
► toBinary(ip:string
⎮number
): string
Defined in index.ts:84
Returns the binary representation of the address, in string form.
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
⎮number
| - |Returns:
string
«Const» toCidr
► toCidr(ip:string
⎮number
): string
Defined in index.ts:119
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
⎮number
| - |Returns:
string
«Const» toHex
► toHex(ip:string
⎮number
): string
Defined in index.ts:97
Provides the hex value of the address.
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
⎮number
| - |Returns:
string
«Const» toInt
► toInt(ipAddress:string
): number
Defined in index.ts:35
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ipAddress |
string
| - |Returns:
number
«Const» toIntRange
► toIntRange(cidr:string
): number
Defined in index.ts:159
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
number
«Const» toOctets
► toOctets(input:string
⎮number
): number
Defined in index.ts:62
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | input |
string
⎮number
| - |Returns:
number
«Const» toRange
► toRange(cidr:string
): string
Defined in index.ts:164
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» toString
► toString(ipInt:number
): string
Defined in index.ts:43
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ipInt |
number
| - |Returns:
string
«Const» usable
► usable(cidr:string
): string
Defined in index.ts:192
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
«Const» validateCidr
► validateCidr(cidr:string
): string
⎮null
Defined in index.ts:256
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
⎮null
«Const» validateIp
► validateIp(ip:string
): string
⎮null
Defined in index.ts:126
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | ip |
string
| - |Returns:
string
⎮null
«Const» wildcardmask
► wildcardmask(cidr:string
): string
Defined in index.ts:203
Parameters:
| Param | Type | Description | | ------ | ------ | ------ | | cidr |
string
| - |Returns:
string
Object literal: cidr
address
● address: address()Defined in index.ts:287
broadcast
● broadcast: broadcast()Defined in index.ts:280
commonCidr
● commonCidr: cidrCommonCidr() = cidrCommonCidrDefined in index.ts:274
count
● count: count()Defined in index.ts:277
includes
● includes: includes()Defined in index.ts:283
ips
● ips: ips()Defined in index.ts:282
mask
● mask: mask()Defined in index.ts:288
max
● max: max()Defined in index.ts:275
min
● min: min()Defined in index.ts:276
netmask
● netmask: netmask()Defined in index.ts:278
next
● next: nextCidr() = nextCidrDefined in index.ts:285
previous
● previous: previousCidr() = previousCidrDefined in index.ts:286
random
● random: random()Defined in index.ts:284
subnets
● subnets: subnets()Defined in index.ts:281
toIntRange
● toIntRange: toIntRange()Defined in index.ts:273
toRange
● toRange: toRange()Defined in index.ts:271
usable
● usable: usable()Defined in index.ts:272
validate
● validate: validateCidr() = validateCidrDefined in index.ts:289
wildcardmask
● wildcardmask: wildcardmask()Defined in index.ts:279
Object literal: ip
commonCidr
● commonCidr: ipCommonCidr() = ipCommonCidrDefined in index.ts:142
next
● next: next()Defined in index.ts:148
previous
● previous: previous()Defined in index.ts:147
reverse
● reverse: reverse()Defined in index.ts:146
toBinary
● toBinary: toBinary()Defined in index.ts:145
toCidr
● toCidr: toCidr()Defined in index.ts:149
toHex
● toHex: toHex()Defined in index.ts:143
toInt
● toInt: toInt()Defined in index.ts:140
toOctets
● toOctets: toOctets()Defined in index.ts:144
toString
● toString: toString()Defined in index.ts:141
validate
● validate: validateIp() = validateIpDefined in index.ts:150