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

@kleinron/ipv4

v0.2.1

Published

Drop-in for ipaddr.js IPv4 (MIT) — regex-free loose/inet_aton parse with a fast strict four-part path

Readme

@kleinron/ipv4

Drop-in for ipaddr.js IPv4 (MIT).

Same static and instance surface as ipaddr.IPv4: loose / inet_aton-style parse / isValid (octal, hex, short forms) via a regex-free digit/base scanner, plus a fast strict four-part path behind isValidFourPartDecimal (shared branchy scanner with the C89 peer grammar for the strict case).

Shipped src/ contains no RegExp — accept set pinned to [email protected].

Parity oracle: ipaddr.js 2.5.0 (pinned devDependency).

Install

npm install @kleinron/ipv4

Requires Node.js >= 18.

API

import { IPv4 } from "@kleinron/ipv4";
// or: import ipv4 from "@kleinron/ipv4"; const { IPv4 } = ipv4;

IPv4.isValid("192.0.2.1");              // true
IPv4.isValid("0177.0.0.1");             // true (octal / loose)
IPv4.isValidFourPartDecimal("192.0.2.1"); // true (strict)
IPv4.isValidFourPartDecimal("0177.0.0.1"); // false

const addr = IPv4.parse("127.1");       // loose → 127.0.0.1
addr.octets;                            // [127, 0, 0, 1]
addr.toString();                        // "127.0.0.1"
addr.kind();                            // "ipv4"
addr.range();                           // "loopback"

IPv4.parseCIDR("192.168.1.10/24");
IPv4.networkAddressFromCIDR("192.168.1.10/24").toString();  // "192.168.1.0"
IPv4.broadcastAddressFromCIDR("192.168.1.10/24").toString(); // "192.168.1.255"
IPv4.subnetMaskFromPrefixLength(24).toString();              // "255.255.255.0"

Statics (match ipaddr.IPv4)

isIPv4, isValid, isValidCIDR, isValidFourPartDecimal, isValidCIDRFourPartDecimal, parse, parseCIDR, parser, subnetMaskFromPrefixLength, networkAddressFromCIDR, broadcastAddressFromCIDR

Instance

octets, kind, match, range, toString, toNormalizedString, toByteArray, prefixLengthFromSubnetMask, toIPv4MappedAddress, SpecialRanges

Full IPv6 dual-stack Address is out of scope; only thin support for toIPv4MappedAddress (::ffff:a.b.c.d).

Test

npm test

Parity suite compares our IPv4.* to ipaddr.IPv4.* (oracle 2.5.0) over a corpus of valid / invalid / CIDR / loose forms. fixtures/cases.json drives the strict four-part suite (shared grammar with the C89 research peer).

Layout

  • src/ipv4.js — IPv4 class (drop-in)
  • src/scan.js — strict four-part scanner (fast path)
  • src/aton.js — loose / inet_aton parser + CIDR split
  • src/index.js — export { IPv4 } and export default { IPv4 }
  • fixtures/cases.json — strict four-part corpus
  • bench/ — dev-only harness (not published)
  • UPSTREAM.md — guts map for upstream PR

License

MIT