{"id":50657494,"url":"https://github.com/elfensky/alpha5","last_synced_at":"2026-06-08T00:30:35.335Z","repository":{"id":358948924,"uuid":"1243770856","full_name":"elfensky/alpha5","owner":"elfensky","description":"NORAD Alpha-5 designator codec — encode/decode satellite catalog IDs between integers and the 5-character Space-Track format (100123 ↔ A0123). Zero deps, ESM, Node 20+.","archived":false,"fork":false,"pushed_at":"2026-05-19T18:42:05.000Z","size":59,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-19T21:49:48.027Z","etag":null,"topics":["aerospace","alpha5","codec","esm","nodejs","norad","norad-cat-id","satellite","satellite-catalog","space-track","tle","zero-dependencies"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/alpha5","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elfensky.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-19T16:42:36.000Z","updated_at":"2026-05-19T20:21:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/elfensky/alpha5","commit_stats":null,"previous_names":["elfensky/alpha5"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/elfensky/alpha5","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elfensky%2Falpha5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elfensky%2Falpha5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elfensky%2Falpha5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elfensky%2Falpha5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elfensky","download_url":"https://codeload.github.com/elfensky/alpha5/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elfensky%2Falpha5/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34043822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aerospace","alpha5","codec","esm","nodejs","norad","norad-cat-id","satellite","satellite-catalog","space-track","tle","zero-dependencies"],"created_at":"2026-06-08T00:30:32.383Z","updated_at":"2026-06-08T00:30:35.329Z","avatar_url":"https://github.com/elfensky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alpha5\n\n[![CI](https://github.com/elfensky/alpha5/actions/workflows/ci.yml/badge.svg)](https://github.com/elfensky/alpha5/actions/workflows/ci.yml)\n\nNORAD 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 (`A0123` ↔ `100123`). Zero dependencies. Pure ESM. ~70 lines of source. The spec is frozen by the US Space Force.\n\n## Install\n\n```bash\nnpm install alpha5\n```\n\nRequires Node.js 20 or newer. Works in browsers as well — no runtime dependencies.\n\n## Usage\n\n```js\nimport { decode, encode } from 'alpha5';\n// or, for a namespace import:\n//   import * as alpha5 from 'alpha5';\n//   alpha5.decode('A0123');\n\n// Plain numeric designators round-trip unchanged.\ndecode('25544'); // 25544\nencode(25544); // '25544'\n\n// Alpha-5 designators decode to their canonical integer.\ndecode('A0123'); // 100123\nencode(100123); // 'A0123'\n\n// The I/O letters are reserved.\ndecode('I0000'); // throws Error\ndecode('O0000'); // throws Error\n\n// Boundaries: A0000 = 100,000, Z9999 = 339,999.\nencode(339999); // 'Z9999'\nencode(340000); // throws Error: exceeds Alpha-5 range\n```\n\n## API\n\n### `decode(s: string): number`\n\nDecode a NORAD designator string into its integer value in the range `0..339_999`.\n\nAccepts 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.\n\nThrows if the input:\n\n- is not a string, or is empty\n- has whitespace, a sign prefix, or a decimal/scientific/hex/octal/binary marker\n- uses a reserved letter (`I` or `O`)\n- uses a lowercase letter\n- has a non-digit tail after the letter prefix\n- decodes to a value greater than `339_999`\n\n### `encode(n: number): string`\n\nEncode an integer NORAD ID into its 5-character designator string.\n\n- Values `0..99_999` are zero-padded to 5 digits (`encode(7) === \"00007\"`).\n- Values `100_000..339_999` use the Alpha-5 letter prefix (`encode(100123) === \"A0123\"`).\n- Output is **always exactly 5 characters** and never contains the reserved letters `I` or `O`.\n\nThrows 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.\n\n## The full letter table\n\nVerbatim from the [Space-Track Alpha-5 documentation](https://www.space-track.org/documentation#tle-alpha5):\n\n| Letter | Value |     | Letter | Value |     | Letter | Value |\n| ------ | ----- | --- | ------ | ----- | --- | ------ | ----- |\n| A      | 10    |     | J      | 18    |     | S      | 26    |\n| B      | 11    |     | K      | 19    |     | T      | 27    |\n| C      | 12    |     | L      | 20    |     | U      | 28    |\n| D      | 13    |     | M      | 21    |     | V      | 29    |\n| E      | 14    |     | N      | 22    |     | W      | 30    |\n| F      | 15    |     | P      | 23    |     | X      | 31    |\n| G      | 16    |     | Q      | 24    |     | Y      | 32    |\n| H      | 17    |     | R      | 25    |     | Z      | 33    |\n\n`I` and `O` are omitted.\n\n## Why\n\nWhen 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.\n\nIf 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.\n\nSpec: \u003chttps://www.space-track.org/documentation#tle-alpha5\u003e\n\n## Stability\n\nThe 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.\n\nIf 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.\n\n## What's not provided\n\n- **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.\n- **No bulk parsing of TLE/3LE lines.** This is a codec for the catalog-ID field only. Use a TLE parser like [`tle.js`](https://www.npmjs.com/package/tle.js) for full TLE/3LE handling and pass the catalog field through `decode` after extraction.\n- **No error subclasses.** All failures throw a plain `Error` with a descriptive message. If you need to distinguish failure modes, match on the message.\n\n## License\n\nMIT © Andrei Lavrenov\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felfensky%2Falpha5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felfensky%2Falpha5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felfensky%2Falpha5/lists"}