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

ipv6-ddn

v1.0.1

Published

A library to convert between Standard IPv6 (Hex) and IPv6 Decimal Dot Notation (DDN) with canonicalization support.

Readme

IPv6 Decimal Dot Notation (IPv6-DDN) Converter

A lightweight, zero-dependency JavaScript library to convert IPv6 addresses between the standard Hexadecimal format and the experimental Decimal Dot Notation (IPv6-DDN).

What is IPv6-DDN?

IPv6 Decimal Dot Notation (IPv6-DDN) is a proposed format designed to make IPv6 addresses more readable for humans familiar with IPv4.

Instead of using hexadecimal blocks separated by colons (e.g., 2001:db8::1), IPv6-DDN represents the 128-bit address as 8 segments of 16-bit decimal integers (0-65535) separated by dots (.).

| Format | Example | | ------------- | -------------- | | Standard IPv6 | 2001:db8::1 | | IPv6-DDN | 8193.3512..1 |

It supports zero-compression using double dots (..) similar to the double colon (::) in standard IPv6.

Features

  • Bi-directional Conversion: Standard Hex to/from Decimal Dot.
  • Canonicalization: Implements RFC 5952 style rules (longest run of zeros, leftmost preference) for both formats.
  • Type Detection: Identify whether a string is IPv4, IPv6 (Standard), or IPv6-DDN.
  • Universal Support: Works in Node.js (CommonJS), Browsers (Global), and AMD environments.

Usage

Node.js

const IPv6DDN = require('./ipv6_ddn.js');

// Convert Standard to DDN
const ddn = IPv6DDN.fromStandard("2001:db8::1");
console.log(ddn); // Output: "8193.3512..1"

// Convert DDN to Standard
const std = IPv6DDN.toStandard("8193.3512..1");
console.log(std); // Output: "2001:db8::1"

Browser

<script src="ipv6_ddn.js"></script>
<script>
    const type = IPv6DDN.getType("8193.3512..1");
    if (type === "ipv6_ddn") {
        console.log("Valid DDN Address detected!");
    }
</script>

API Reference

fromStandard(standardIP)

Converts a Standard IPv6 string (Hex:Colon) to Decimal Dot Notation.

  • standardIP (String): The standard IPv6 address (e.g., 2001:db8::1).
  • Returns (String): The canonical IPv6-DDN string.
  • Throws: Error if the input format is invalid.

toStandard(ddnIP)

Converts an IPv6-DDN string (Decimal.Dot) to Standard IPv6 notation.

  • ddnIP (String): The IPv6-DDN address (e.g., 8193.3512..1).
  • Returns (String): The canonical Standard IPv6 string.
  • Throws: Error if the input format is invalid or segments exceed 65535.

getType(ipaddrText)

Detects the format of a given IP address string.

  • ipaddrText (String): The IP string to analyze.
  • Returns (String):
    • "ipv4": Valid standard IPv4.
    • "ipv6": Valid standard IPv6.
    • "ipv6_ddn": Valid IPv6 Decimal Dot Notation.
    • "unknown": Invalid or unrecognized format.

isDDN(ipaddrText)

Checks if a string is a valid IPv6-DDN address.

  • ipaddrText (String): The text to check.
  • Returns (Boolean): true if valid, false otherwise.

Examples

| Function | Input | Output | | -------------- | ----- | ------ | | fromStandard | ::1 | ..1 | | fromStandard | 2001:db8:0:0:1:0:0:1 | 8193.3512.0.0.1..1 | | toStandard | .. | :: | | toStandard | 0010..1 | a::1 | | getType | 192.168.1.1 | ipv4 |

Running Tests

This library includes a comprehensive unit test suite covering edge cases, compression rules, and error handling.

npm run test

Specification

Specification v1.0.0

License

This project is licensed under the Mozilla Public License 2.0 (MPL 2.0) additional terms.

For more details, see the LICENSE and LICENSE.additional files.