Home

Awesome

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

Object literals


Variables

<a id="invalidchars"></a>

«Const» invalidChars

● invalidChars: RegExp = /^.?(?=[^#%&$*:<>?/{|}[a-zA-Z]).$/

Defined in index.ts:3


Functions

<a id="address"></a>

«Const» address

address(ip: string): string

Defined in index.ts:155

Parameters:

ParamTypeDescription
ipstring-

Returns: string


<a id="broadcast"></a>

«Const» broadcast

broadcast(cidr: string): string

Defined in index.ts:175

Parameters:

ParamTypeDescription
cidrstring-

Returns: string


<a id="cidrcommoncidr"></a>

«Const» cidrCommonCidr

cidrCommonCidr(cidrs: string[]): string

Defined in index.ts:166

Parameters:

ParamTypeDescription
cidrsstring[]-

Returns: string


<a id="count"></a>

«Const» count

count(cidr: string): number

Defined in index.ts:190

Parameters:

ParamTypeDescription
cidrstring-

Returns: number


<a id="includes"></a>

«Const» includes

includes(cidr: string, ip: string): boolean

Defined in index.ts:240

Parameters:

ParamTypeDescription
cidrstring-
ipstring-

Returns: boolean


<a id="intcommoncidr"></a>

«Const» intCommonCidr

intCommonCidr(ips: number[]): string

Defined in index.ts:5

Parameters:

ParamTypeDescription
ipsnumber[]-

Returns: string


<a id="ipcommoncidr"></a>

«Const» ipCommonCidr

ipCommonCidr(ips: string[]): string

Defined in index.ts:57

Parameters:

ParamTypeDescription
ipsstring[]-

Returns: string


<a id="ips"></a>

«Const» ips

ips(cidr: string): string[]

Defined in index.ts:229

Parameters:

ParamTypeDescription
cidrstring-

Returns: string[]


<a id="mask"></a>

«Const» mask

mask(ip: string): number

Defined in index.ts:157

Parameters:

ParamTypeDescription
ipstring-

Returns: number


<a id="max"></a>

«Const» max

max(cidr: string): string

Defined in index.ts:184

Parameters:

ParamTypeDescription
cidrstring-

Returns: string


<a id="min"></a>

«Const» min

min(cidr: string): string

Defined in index.ts:177

Parameters:

ParamTypeDescription
cidrstring-

Returns: string


<a id="netmask"></a>

«Const» netmask

netmask(cidr: string): string

Defined in index.ts:172

Parameters:

ParamTypeDescription
cidrstring-

Returns: string


<a id="next"></a>

«Const» next

next(ip: string): string

Defined in index.ts:111

Returns the next adjacent address.

Parameters:

ParamTypeDescription
ipstring-

Returns: string


<a id="nextcidr"></a>

«Const» nextCidr

nextCidr(cidr: string): string

Defined in index.ts:245

Parameters:

ParamTypeDescription
cidrstring-

Returns: string


<a id="padleft"></a>

«Const» padLeft

padLeft(input: string, char: string, min: number): string

Defined in index.ts:26

Parameters:

ParamTypeDescription
inputstring-
charstring-
minnumber-

Returns: string


<a id="previous"></a>

«Const» previous

previous(ip: string): string

Defined in index.ts:117

Returns the previous adjacent address.

Parameters:

ParamTypeDescription
ipstring-

Returns: string


<a id="previouscidr"></a>

«Const» previousCidr

previousCidr(cidr: string): string

Defined in index.ts:248

Parameters:

ParamTypeDescription
cidrstring-

Returns: string


<a id="random"></a>

«Const» random

random(cidr: string): string

Defined in index.ts:251

Parameters:

ParamTypeDescription
cidrstring-

Returns: string


<a id="reverse"></a>

«Const» reverse

reverse(ip: stringnumber): string

Defined in index.ts:73

Returns the reverse lookup hostname for the address.

Parameters:

ParamTypeDescription
ipstringnumber-

Returns: string


<a id="subnets"></a>

«Const» subnets

subnets(cidr: string, subMask: number, limit: number): string[]

Defined in index.ts:206

Parameters:

ParamTypeDescription
cidrstring-
subMasknumber-
limitnumber-

Returns: string[]


<a id="tobinary"></a>

«Const» toBinary

toBinary(ip: stringnumber): string

Defined in index.ts:84

Returns the binary representation of the address, in string form.

Parameters:

ParamTypeDescription
ipstringnumber-

Returns: string


<a id="tocidr"></a>

«Const» toCidr

toCidr(ip: stringnumber): string

Defined in index.ts:119

Parameters:

ParamTypeDescription
ipstringnumber-

Returns: string


<a id="tohex"></a>

«Const» toHex

toHex(ip: stringnumber): string

Defined in index.ts:97

Provides the hex value of the address.

Parameters:

ParamTypeDescription
ipstringnumber-

Returns: string


<a id="toint"></a>

«Const» toInt

toInt(ipAddress: string): number

Defined in index.ts:35

Parameters:

ParamTypeDescription
ipAddressstring-

Returns: number


<a id="tointrange"></a>

«Const» toIntRange

toIntRange(cidr: string): number[]

Defined in index.ts:159

Parameters:

ParamTypeDescription
cidrstring-

Returns: number[]


<a id="tooctets"></a>

«Const» toOctets

toOctets(input: stringnumber): number[]

Defined in index.ts:62

Parameters:

ParamTypeDescription
inputstringnumber-

Returns: number[]


<a id="torange"></a>

«Const» toRange

toRange(cidr: string): string[]

Defined in index.ts:164

Parameters:

ParamTypeDescription
cidrstring-

Returns: string[]


<a id="tostring"></a>

«Const» toString

toString(ipInt: number): string

Defined in index.ts:43

Parameters:

ParamTypeDescription
ipIntnumber-

Returns: string


<a id="usable"></a>

«Const» usable

usable(cidr: string): string[]

Defined in index.ts:192

Parameters:

ParamTypeDescription
cidrstring-

Returns: string[]


<a id="validatecidr"></a>

«Const» validateCidr

validateCidr(cidr: string): stringnull

Defined in index.ts:256

Parameters:

ParamTypeDescription
cidrstring-

Returns: stringnull


<a id="validateip"></a>

«Const» validateIp

validateIp(ip: string): stringnull

Defined in index.ts:126

Parameters:

ParamTypeDescription
ipstring-

Returns: stringnull


<a id="wildcardmask"></a>

«Const» wildcardmask

wildcardmask(cidr: string): string

Defined in index.ts:203

Parameters:

ParamTypeDescription
cidrstring-

Returns: string


<a id="cidr"></a>

Object literal: cidr

<a id="cidr.address"></a>

address

● address: address

Defined in index.ts:287


<a id="cidr.broadcast"></a>

broadcast

● broadcast: broadcast

Defined in index.ts:280


<a id="cidr.commoncidr"></a>

commonCidr

● commonCidr: cidrCommonCidr = cidrCommonCidr

Defined in index.ts:274


<a id="cidr.count"></a>

count

● count: count

Defined in index.ts:277


<a id="cidr.includes"></a>

includes

● includes: includes

Defined in index.ts:283


<a id="cidr.ips"></a>

ips

● ips: ips

Defined in index.ts:282


<a id="cidr.mask"></a>

mask

● mask: mask

Defined in index.ts:288


<a id="cidr.max"></a>

max

● max: max

Defined in index.ts:275


<a id="cidr.min"></a>

min

● min: min

Defined in index.ts:276


<a id="cidr.netmask"></a>

netmask

● netmask: netmask

Defined in index.ts:278


<a id="cidr.next"></a>

next

● next: nextCidr = nextCidr

Defined in index.ts:285


<a id="cidr.previous"></a>

previous

● previous: previousCidr = previousCidr

Defined in index.ts:286


<a id="cidr.random"></a>

random

● random: random

Defined in index.ts:284


<a id="cidr.subnets"></a>

subnets

● subnets: subnets

Defined in index.ts:281


<a id="cidr.tointrange"></a>

toIntRange

● toIntRange: toIntRange

Defined in index.ts:273


<a id="cidr.torange"></a>

toRange

● toRange: toRange

Defined in index.ts:271


<a id="cidr.usable"></a>

usable

● usable: usable

Defined in index.ts:272


<a id="cidr.validate"></a>

validate

● validate: validateCidr = validateCidr

Defined in index.ts:289


<a id="cidr.wildcardmask"></a>

wildcardmask

● wildcardmask: wildcardmask

Defined in index.ts:279


<a id="ip"></a>

Object literal: ip

<a id="ip.commoncidr"></a>

commonCidr

● commonCidr: ipCommonCidr = ipCommonCidr

Defined in index.ts:142


<a id="ip.next"></a>

next

● next: next

Defined in index.ts:148


<a id="ip.previous"></a>

previous

● previous: previous

Defined in index.ts:147


<a id="ip.reverse"></a>

reverse

● reverse: reverse

Defined in index.ts:146


<a id="ip.tobinary"></a>

toBinary

● toBinary: toBinary

Defined in index.ts:145


<a id="ip.tocidr"></a>

toCidr

● toCidr: toCidr

Defined in index.ts:149


<a id="ip.tohex"></a>

toHex

● toHex: toHex

Defined in index.ts:143


<a id="ip.toint"></a>

toInt

● toInt: toInt

Defined in index.ts:140


<a id="ip.tooctets"></a>

toOctets

● toOctets: toOctets

Defined in index.ts:144


<a id="ip.tostring"></a>

toString

● toString: toString

Defined in index.ts:141


<a id="ip.validate"></a>

validate

● validate: validateIp = validateIp

Defined in index.ts:150