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 🙏

© 2026 – Pkg Stats / Ryan Hefner

iipp

v0.6.3

Published

IPv4 and v6 address parser

Readme

iipp

Small module to parse and work with IPv4 and IPv6 addresses.

Features:

  • Parsing IPv4 and IPv6 Addresses with CIDR
  • Printing IPv4 and IPv6 (compressed and uncompressed)
  • Checking whether an address or an subnet is covered/included in another one

Usage

Parse IPv4 address

let address = V4Address.parse('1.2.3.4');

If an invalid address is given, null is returned.

Parse IPv6 address

let address = V6Address.parse('::1');

If an invalid address is given, null is returned.

Check whether a subnet covers/includes another one

let net = V4Address.parse('10.0.0.0/8');
let address = V4Address.parse('5.0.0.0');
net.covers(address); // => false

The covers method also accepts a string. If the given string is not a valid address, false is returned.

let net = V4Address.parse('10.0.0.0/8');
net.covers('5.0.0.0'); // => false
net.covers('10.2.3.4'); // => true
net.covers('10.0.0.300'); // => false

Available types

Address

Base class representing an address or net.

Attributes

  • addressType: int 4 or 6 - size: int Address size in bits (32 or 128)
  • bytes: int[] Address data as 8-bit unsigned
  • subnetSize: int Size of the subnet mask in bits

Methods

  • covers(Address | string): bool Checks whether the current net covers/includes the given address
  • toString({ appendCIDR = undefined, uncompressed = false }): string Formats the address to a string
    • appendCIDR: When appendCIDR is undefined, the CIDR is appended only when the address object defines a subnet
    • uncompressed: The uncompressed parameter takes effect only on V6Address objects

V4Address extends Address

IPv4 address or net.

Attributes

  • addressType: int => 4
  • size: int => 32
  • bytes: int[4] Address data as 8-bit unsigned ints
  • subnetSize: int Size of the subnet mask in bits

Methods

  • covers(Address | string): bool Checks whether the current net covers/includes the given address
  • toString({ appendCIDR = undefined }): string Formats the address to a string
    • appendCIDR: When appendCIDR is undefined, the CIDR is appended only when the address object defines a subnet
  • clone(): V4Address Creates clone of this address object
  • static parse(string): V4Address Parses an IPv4 address or net. Returns null for invalid data.

V6Address extends Address

IPv6 address or net.

Attributes

  • addressType: int => 6
  • size: int => 128
  • bytes: int[16] Address data as 8-bit unsigned ints
  • blocks: int[8] Address data as 16-bit unsigned ints
  • subnetSize: int Size of the subnet mask in bits

Methods

  • covers(Address | string): bool Checks whether the current net covers/includes the given address
  • toString({ appendCIDR = true, uncompressed = false }): string Formats the address to a string
    • appendCIDR: When appendCIDR is undefined, the CIDR is appended only when the address object defines a subnet
  • toUncompressedString({ appendCIDR = undefined }): string Formats the address to a string
    • appendCIDR: When appendCIDR is undefined, the CIDR is appended only when the address object defines a subnet
  • clone(): V6Address Creates clone of this address object
  • static parse(string): V6Address Parses an IPv6 address or net. Returns null for invalid data.

Examples

let address = V4Address.parse('1.2.3.4');
/* address => V4Address
	- addressType: 4
	- size: 32
	- bytes: [1, 2, 3, 4]
	- subnetSize: 32
*/

let address = V4Address.parse('5.6.7.8/12');
/* address => V4Address
	- addressType: 4
	- size: 32
	- bytes: [5, 6, 7, 8]
	- subnetSize: 12
*/


let address = V4Address.parse('1.2.288.4'); //Invalid valid at position 3
/* address => null */

let address = V4Address.parse('1.2.3.4/42'); //Invalid CIDR value
/* address => null */



let address = V6Address.parse('::1');
/* address => V6Address
	- addressType: 6
	- size: 128
	- bytes: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
	- subnetSize: 128
*/
address.toUncompressedString(); // => 0000:0000:0000:0000:0000:0000:0000:0001/128
address.toString(); // => ::1
address.toString({ appendCIDR: true }); // => ::1/128


let address = V6Address.parse('::1:0:0:0:0:0/100');
/* address => V6Address
	- addressType: 6
	- size: 128
	- bytes: [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
	- subnetSize: 128
*/
address.toUncompressedString(); // => 0000:0000:0001:0000:0000:0000:0000:0000/100
address.toString(); // => 0:0:1::/100
address.toString({ appendCIDR: false }); // => 0:0:1::