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

alpha5

v1.0.1

Published

NORAD Alpha-5 designator codec — encode/decode satellite catalog IDs between integers and the 5-character Space-Track format.

Readme

alpha5

CI

NORAD Alpha-5 designator codec — encode and decode satellite catalog IDs between integers and the 5-character format used by Space-Track and modern TLE/3LE files (A0123100123). Zero dependencies. Pure ESM. ~70 lines of source. The spec is frozen by the US Space Force.

Install

npm install alpha5

Requires Node.js 20 or newer. Works in browsers as well — no runtime dependencies.

Usage

import { decode, encode } from 'alpha5';
// or, for a namespace import:
//   import * as alpha5 from 'alpha5';
//   alpha5.decode('A0123');

// Plain numeric designators round-trip unchanged.
decode('25544'); // 25544
encode(25544); // '25544'

// Alpha-5 designators decode to their canonical integer.
decode('A0123'); // 100123
encode(100123); // 'A0123'

// The I/O letters are reserved.
decode('I0000'); // throws Error
decode('O0000'); // throws Error

// Boundaries: A0000 = 100,000, Z9999 = 339,999.
encode(339999); // 'Z9999'
encode(340000); // throws Error: exceeds Alpha-5 range

API

decode(s: string): number

Decode a NORAD designator string into its integer value in the range 0..339_999.

Accepts both plain numeric strings ("25544", "00007") and Alpha-5 designators ("A0123", "Z9999"). Numeric inputs of any length are accepted, so JSON sources that omit leading zeros (e.g. "7" instead of "00007") still decode correctly.

Throws if the input:

  • is not a string, or is empty
  • has whitespace, a sign prefix, or a decimal/scientific/hex/octal/binary marker
  • uses a reserved letter (I or O)
  • uses a lowercase letter
  • has a non-digit tail after the letter prefix
  • decodes to a value greater than 339_999

encode(n: number): string

Encode an integer NORAD ID into its 5-character designator string.

  • Values 0..99_999 are zero-padded to 5 digits (encode(7) === "00007").
  • Values 100_000..339_999 use the Alpha-5 letter prefix (encode(100123) === "A0123").
  • Output is always exactly 5 characters and never contains the reserved letters I or O.

Throws if n is not a non-negative finite integer, or exceeds 339_999. BigInt, booleans, strings, null, undefined, NaN, ±Infinity, and non-integer floats are all rejected — only plain finite integers are accepted.

The full letter table

Verbatim from the Space-Track Alpha-5 documentation:

| Letter | Value | | Letter | Value | | Letter | Value | | ------ | ----- | --- | ------ | ----- | --- | ------ | ----- | | A | 10 | | J | 18 | | S | 26 | | B | 11 | | K | 19 | | T | 27 | | C | 12 | | L | 20 | | U | 28 | | D | 13 | | M | 21 | | V | 29 | | E | 14 | | N | 22 | | W | 30 | | F | 15 | | P | 23 | | X | 31 | | G | 16 | | Q | 24 | | Y | 32 | | H | 17 | | R | 25 | | Z | 33 |

I and O are omitted.

Why

When the satellite catalog approached the 100,000-object limit of the legacy 5-digit NORAD field, the US Space Force introduced Alpha-5 as a stopgap: the first character of the 5-char field becomes a letter (A=10 through Z=33, skipping I and O to avoid confusion with 1 and 0), extending the addressable range to 339,999 objects.

If you ingest TLE, 3LE, or GP/GP_HISTORY data from Space-Track, you need this codec. The official Space-Track API only accepts integer NORAD IDs for filtering, so any 5-char designator coming in must be decoded before you can use it as a database key or query parameter.

Spec: https://www.space-track.org/documentation#tle-alpha5

Stability

The Alpha-5 spec is frozen by the US Space Force. This library follows it exactly and is tested against every example in the official documentation, the full letter table, both I/O-skip boundaries in both directions, and a round-trip property check across the entire 0–339,999 range.

If the spec ever changes (Space-Track recommends migrating to XML/JSON/KVN for new work — Alpha-5 is itself a stopgap), this library will follow.

What's not provided

  • No unpadded output option. The library produces canonical 5-character Alpha-5; if you want unpadded output for IDs below 100,000, that's just String(n). Variable-width output is not part of the Alpha-5 spec and would dilute the library's purpose.
  • No bulk parsing of TLE/3LE lines. This is a codec for the catalog-ID field only. Use a TLE parser like tle.js for full TLE/3LE handling and pass the catalog field through decode after extraction.
  • No error subclasses. All failures throw a plain Error with a descriptive message. If you need to distinguish failure modes, match on the message.

License

MIT © Andrei Lavrenov