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

@rkingon/parse-address

v1.0.1

Published

US street address parser. Modern TypeScript rebuild of parse-address (Geo::StreetAddress::US).

Readme

@rkingon/parse-address

A forgiving US street-address parser. Turns free-form address strings into structured components — number, street, unit, city, state, ZIP — with support for directionals, secondary units, PO boxes, grid-style numbers, intersections, and the full set of USPS street-type and state abbreviations.

A modern, dependency-light TypeScript rebuild of the classic parse-address, itself a port of Perl's Geo::StreetAddress::US.

Installation

npm install @rkingon/parse-address
# or
pnpm add @rkingon/parse-address
# or
yarn add @rkingon/parse-address

Quick Start

import { parseLocation } from '@rkingon/parse-address';

parseLocation('1005 N Gravenstein Highway Sebastopol CA 95472');
// {
//   number: '1005',
//   prefix: 'N',
//   street: 'Gravenstein',
//   type:   'Hwy',
//   city:   'Sebastopol',
//   state:  'CA',
//   zip:    '95472',
// }

Every result is a ParsedAddress; unmatched inputs return null.

Features

  • Typed results — a fully typed ParsedAddress, every field optional.
  • One entry pointparseLocation auto-detects addresses, PO boxes, and intersections and dispatches accordingly.
  • Normalized output — street types, directionals, and state names collapse to their canonical USPS forms (HighwayHwy, NorthN, CaliforniaCA).
  • Handles the awkward cases — secondary units (Suite 500, Apt 2, #3), ZIP+4, grid numbers (N95W18855), directional house numbers (W11001, W 11001), fractional addresses, and intersections.
  • Dual ESM / CJS with types for both.

Usage

The general parser

parseLocation is the entry point for most uses. It figures out what kind of input it's looking at:

import { parseLocation } from '@rkingon/parse-address';

parseLocation('1005 N Gravenstein Hwy Suite 500 Sebastopol, CA');
// { number, prefix, street, type, sec_unit_type: 'Suite', sec_unit_num: '500', city, state }

parseLocation('P.O. box 3094 Collierville TN 38027');
// { sec_unit_type: 'PO box', sec_unit_num: '3094', city, state, zip }

parseLocation('Mission St and Valencia St San Francisco CA');
// { street1: 'Mission', type1: 'St', street2: 'Valencia', type2: 'St', city, state }

The specific parsers

Reach for these when you already know the shape of the input:

import {
  parseAddress,          // strict: requires a house number + street
  parseInformalAddress,  // forgiving: pieces may be missing
  parsePoAddress,        // PO-box-style (unit + place, no street)
  parseIntersection,     // two cross streets
} from '@rkingon/parse-address';

parseAddress('7800 Mill Station Rd, Sebastopol, CA 95472');
parseInformalAddress('Apt 2, 1600 Pennsylvania Ave');

API

| Function | Description | |----------|-------------| | parseLocation(input) | Auto-detects the input type and dispatches. The general-purpose entry point. | | parseAddress(input) | Strict full address (house number + street required). | | parseInformalAddress(input) | Forgiving parse; components may be absent. | | parsePoAddress(input) | PO-box-style input (secondary unit + place). | | parseIntersection(input) | Two streets joined by a corner token (and, &, at). |

All return ParsedAddress | null.

ParsedAddress

interface ParsedAddress {
  number?: string;         // house / building number
  prefix?: string;         // leading directional (N, SW, …)
  street?: string;
  type?: string;           // normalized + title-cased street type (Hwy, Ave, …)
  suffix?: string;         // trailing directional
  sec_unit_type?: string;  // Suite, Apt, PO box, …
  sec_unit_num?: string;
  city?: string;
  state?: string;          // two-letter USPS code
  zip?: string;
  plus4?: string;

  // intersections
  prefix1?: string; street1?: string; type1?: string; suffix1?: string;
  prefix2?: string; street2?: string; type2?: string; suffix2?: string;
}

Credits & lineage

This is a from-scratch TypeScript implementation that preserves the parsing behavior of the original parse-address by hassansin (ISC licensed) and, through it, Perl's Geo::StreetAddress::US by Schuyler D. Erle & Tim Bunce. The USPS abbreviation tables and address grammar are reproduced from that work for functional parity. All credit for the original parsing approach belongs to those authors.

Contributing

This project uses Changesets for versioning and publishing.

pnpm install
pnpm test        # run the conformance suite
pnpm typecheck   # type-check
pnpm build       # emit dist/

To land a change:

  1. Branch and make your change.
  2. Add a changeset: pnpm changeset (pick patch / minor / major).
  3. Commit the changeset with your change and open a PR.

Merging to main opens a "Version Packages" PR; merging that publishes to npm.

License

MIT