[](https://www.npmjs.org/package/example)
npm install node-cidrnode-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.
* 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
---
● invalidChars: RegExp = /^.?(?=[\^#%&$\:<>\?\/\{\|\}[a-zA-Z]).*$/
Defined in index.ts:3
___
► address(ip: string): string
Defined in index.ts:155
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ip | string | - |
Returns: string
___
► broadcast(cidr: string): string
Defined in index.ts:175
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string
___
► cidrCommonCidr(cidrs: string[]): string
Defined in index.ts:166
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidrs | string[] | - |
Returns: string
___
► count(cidr: string): number
Defined in index.ts:190
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: number
___
► includes(cidr: string, ip: string): boolean
Defined in index.ts:240
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
| ip | string | - |
Returns: boolean
___
► intCommonCidr(ips: number[]): string
Defined in index.ts:5
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ips | number[] | - |
Returns: string
___
► ipCommonCidr(ips: string[]): string
Defined in index.ts:57
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ips | string[] | - |
Returns: string
___
► ips(cidr: string): string[]
Defined in index.ts:229
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string[]
___
► mask(ip: string): number
Defined in index.ts:157
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ip | string | - |
Returns: number
___
► max(cidr: string): string
Defined in index.ts:184
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string
___
► min(cidr: string): string
Defined in index.ts:177
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string
___
► netmask(cidr: string): string
Defined in index.ts:172
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string
___
► next(ip: string): string
Defined in index.ts:111
Returns the next adjacent address.
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ip | string | - |
Returns: string
___
► nextCidr(cidr: string): string
Defined in index.ts:245
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string
___
► 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
___
► previous(ip: string): string
Defined in index.ts:117
Returns the previous adjacent address.
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ip | string | - |
Returns: string
___
► previousCidr(cidr: string): string
Defined in index.ts:248
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string
___
► random(cidr: string): string
Defined in index.ts:251
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string
___
► 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
___
► 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[]
___
► 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
___
► toCidr(ip: string⎮number): string
Defined in index.ts:119
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ip | string⎮number | - |
Returns: string
___
► 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
___
► toInt(ipAddress: string): number
Defined in index.ts:35
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ipAddress | string | - |
Returns: number
___
► toIntRange(cidr: string): number[]
Defined in index.ts:159
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: number[]
___
► toOctets(input: string⎮number): number[]
Defined in index.ts:62
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| input | string⎮number | - |
Returns: number[]
___
► toRange(cidr: string): string[]
Defined in index.ts:164
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string[]
___
► toString(ipInt: number): string
Defined in index.ts:43
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ipInt | number | - |
Returns: string
___
► usable(cidr: string): string[]
Defined in index.ts:192
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string[]
___
► validateCidr(cidr: string): string⎮null
Defined in index.ts:256
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string⎮null
___
► validateIp(ip: string): string⎮null
Defined in index.ts:126
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| ip | string | - |
Returns: string⎮null
___
► wildcardmask(cidr: string): string
Defined in index.ts:203
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| cidr | string | - |
Returns: string
___
● address: [address]()
Defined in index.ts:287
● broadcast: [broadcast]()
Defined in index.ts:280
● commonCidr: [cidrCommonCidr]() = cidrCommonCidr
Defined in index.ts:274
● count: [count]()
Defined in index.ts:277
● includes: [includes]()
Defined in index.ts:283
● ips: [ips]()
Defined in index.ts:282
● mask: [mask]()
Defined in index.ts:288
● max: [max]()
Defined in index.ts:275
● min: [min]()
Defined in index.ts:276
● netmask: [netmask]()
Defined in index.ts:278
● next: [nextCidr]() = nextCidr
Defined in index.ts:285
● previous: [previousCidr]() = previousCidr
Defined in index.ts:286
● random: [random]()
Defined in index.ts:284
● subnets: [subnets]()
Defined in index.ts:281
● toIntRange: [toIntRange]()
Defined in index.ts:273
● toRange: [toRange]()
Defined in index.ts:271
● usable: [usable]()
Defined in index.ts:272
● validate: [validateCidr]() = validateCidr
Defined in index.ts:289
● wildcardmask: [wildcardmask]()
Defined in index.ts:279
___
● commonCidr: [ipCommonCidr]() = ipCommonCidr
Defined in index.ts:142
● next: [next]()
Defined in index.ts:148
● previous: [previous]()
Defined in index.ts:147
● reverse: [reverse]()
Defined in index.ts:146
● toBinary: [toBinary]()
Defined in index.ts:145
● toCidr: [toCidr]()
Defined in index.ts:149
● toHex: [toHex]()
Defined in index.ts:143
● toInt: [toInt]()
Defined in index.ts:140
● toOctets: [toOctets]()
Defined in index.ts:144
● toString: [toString]()
Defined in index.ts:141
● validate: [validateIp]() = validateIp
Defined in index.ts:150
___