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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cldn/ip

v2.0.7

Published

A modern, object-oriented TypeScript library for representing and performing arithmetic on IP addresses and subnets.

Downloads

584

Readme

@cldn/ip

Documentation GitHub NPM Downloads Licence CI Coverage: 100%

A modern, object-oriented TypeScript library for representing and performing arithmetic on IP addresses and subnets.

Documentation — API Reference

Usage

Node.js

Install with npm:

npm install @cldn/ip

Import and use:

import {IPv4, IPv6, Subnet} from "@cldn/ip";

Deno

Import the package from npm using the standard prefix:

import {IPv4, IPv6, Subnet} from "npm:@cldn/ip";

Browsers

For browser usage, it is recommended to use a bundler like Vite, or Webpack. If you are using a bundler, follow the same usage as for Node.js.

Alternatively, you can import the library as a JavaScript module from ESM>CDN:


<script type="module">
  import {IPv4, IPv6, Subnet} from "https://esm.sh/@cldn/ip";
</script>

Features

  • Object-oriented representation of IPv4 and IPv6 addresses, and subnets.
  • Comprehensive subnet arithmetic operations (e.g., containment, splitting, merging).
  • Support for CIDR notation for defining and parsing subnets.
  • Easy definition and manipulation of networks and collections of subnets.
  • Support for IPv4-mapped IPv6 addresses.
  • Fully documented, fully typed, and thoroughly tested with 100% coverage.
  • Zero dependencies; compatible with frontend and backend environments without requiring polyfills.

Example

import {IPv4, Subnet} from "@cldn/ip";

// Parse IPv4 address
const ip = IPv4.fromString("213.0.113.42");
// Or use IPAddress.fromString("213.0.113.42") to parse either IPv4 or IPv6

// Create subnet from CIDR notation
const subnet = Subnet.fromCIDR("213.0.113.0/24");

// Check if IP is within subnet
console.log(subnet.contains(ip)); // true

Contact

For bugs, or feature requests, please use GitHub Issues.

For real-time chat or community discussions, join our Matrix space: #community:cloudnode.pro.

Licence

Copyright © 2024–2025 Cloudnode OÜ.

This project is licensed under the terms of the LGPL-3.0 licence.