npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-cidr

v1.0.0

Published

[![view on npm](http://img.shields.io/npm/v/example.svg)](https://www.npmjs.org/package/example)

Downloads

6,653

Readme

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

«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: stringnumber): string

Defined in index.ts:73

Returns the reverse lookup hostname for the address.

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | ip | stringnumber | - |

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: stringnumber): string

Defined in index.ts:84

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

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | ip | stringnumber | - |

Returns: string


«Const» toCidr

toCidr(ip: stringnumber): string

Defined in index.ts:119

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | ip | stringnumber | - |

Returns: string


«Const» toHex

toHex(ip: stringnumber): string

Defined in index.ts:97

Provides the hex value of the address.

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | ip | stringnumber | - |

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: stringnumber): number[]

Defined in index.ts:62

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | input | stringnumber | - |

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): stringnull

Defined in index.ts:256

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | cidr | string | - |

Returns: stringnull


«Const» validateIp

validateIp(ip: string): stringnull

Defined in index.ts:126

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | ip | string | - |

Returns: stringnull


«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 = cidrCommonCidr

Defined 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 = nextCidr

Defined in index.ts:285


previous

● previous: previousCidr = previousCidr

Defined 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 = validateCidr

Defined in index.ts:289


wildcardmask

● wildcardmask: wildcardmask

Defined in index.ts:279


Object literal: ip

commonCidr

● commonCidr: ipCommonCidr = ipCommonCidr

Defined 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 = validateIp

Defined in index.ts:150