# alphanumeric-encoder

> Encodes a number to a letter representation, or decodes it back

Latest version **1.6.1** (published 2023-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install alphanumeric-encoder
pnpm add alphanumeric-encoder
yarn add alphanumeric-encoder
bun add alphanumeric-encoder
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.1 |
| Published | 2023-11-15 |
| First published | 2022-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | M. Scott Lassiter |
| Maintainers | m-scott-lassiter |
| Keywords | alphanumeric, encode, decode, letter to number, number to letter, string to number, number to string |

## Links

- npm: https://www.npmjs.com/package/alphanumeric-encoder
- Repository: https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder
- Homepage: https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder#readme
- Issues: https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder/issues
- npm.io page: https://npm.io/package/alphanumeric-encoder

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.6.1 (latest) — 2023-11-15
- 1.6.0-beta.3 (beta) — 2022-06-04
- 1.6.0 — 2022-06-11
- 1.6.0-beta.2 — 2022-05-20
- 1.6.0-beta.1 — 2022-05-20
- 1.5.2 — 2022-05-14
- 1.5.1 — 2022-05-14
- 1.5.0 — 2022-05-03
- 1.4.0 — 2022-05-02
- 1.3.0 — 2022-05-01
- 1.2.0 — 2022-04-30
- 1.1.1 — 2022-04-28
- 1.1.0 — 2022-04-26
- 1.0.5 — 2022-04-24
- 1.0.4 — 2022-04-24
- … 5 more at https://npm.io/package/alphanumeric-encoder/versions

## README

<div align="center">

[![Alphanumeric Encoder](logo.gif)](https://www.npmjs.com/package/alphanumeric-encoder)

[![NPM Version](https://img.shields.io/npm/v/alphanumeric-encoder)](https://www.npmjs.com/package/alphanumeric-encoder)
[![NPM Package Size](https://img.shields.io/bundlephobia/min/alphanumeric-encoder)](https://www.npmjs.com/package/alphanumeric-encoder)
[![License](https://img.shields.io/github/license/M-Scott-Lassiter/Alphanumeric-Encoder?color=blue)](https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder/blob/main/LICENSE)

---

[![Tests](https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder/actions/workflows/test.yml/badge.svg)](https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder/actions/workflows/test.yml)
[![Build](https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder/actions/workflows/publish.yml/badge.svg)](https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder/actions/workflows/publish.yml)
[![codecov](https://codecov.io/github/M-Scott-Lassiter/Alphanumeric-Encoder/branch/main/graph/badge.svg?token=MLCXIHQJGA)](https://codecov.io/github/M-Scott-Lassiter/Alphanumeric-Encoder)
[![Dependency status](https://img.shields.io/librariesio/release/npm/alphanumeric-encoder)](https://www.npmjs.com/package/alphanumeric-encoder?activeTab=dependencies)
![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/alphanumeric-encoder)
[![Open Issues](https://img.shields.io/github/issues/m-scott-lassiter/alphanumeric-encoder/bug)](https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder/labels/bug)

[![Maintained](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](#envelope-contact)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](/../../blob/main/CONTRIBUTING.md)

---

</div>

<details open="open">
    <summary><b>Table of Contents</b></summary>

<!-- Note: The toc tags mark autogenerated content. Do not manually modify the content here -->

<!-- toc -->

-   [:book: Getting Started](#book-getting-started)
    -   [Purpose](#purpose)
    -   [Install as an NPM Package](#install-as-an-npm-package)
    -   [Use in Javascript](#use-in-javascript)
-   [:gear: API Documentation](#gear-api-documentation)
-   [:hammer_and_wrench: Node and Operating System Support Policy](#hammer_and_wrench-node-and-operating-system-support-policy)
-   [:clipboard: License and Development](#clipboard-license-and-development)
-   [:envelope: Contact](#envelope-contact)

<!-- tocstop -->

</details>

---

## :book: Getting Started

### Purpose

`alphanumeric-encoder` is a lightweight library with no dependencies. It can [encode](/../../blob/main/API.md#encode) an integer into a letter representation, [decode](/../../blob/main/API.md#decode) the letter back into a number, and [deconstruct](/../../blob/main/API.md#deconstruct) combined strings of letters and numbers into an array of decoded numbers.

This is useful for converting letter indexes (used by people) to numbers (used by computers). Examples include:

-   Spreadsheet columns (e.g. Microsoft Excel's end column is "XFD" which corresponds to 16384)
-   Game boards (e.g. Chess, Battleship) use letters and numbers to identify the grid
-   Geodesy grid reference systems (e.g. the [United States National Grid](https://en.wikipedia.org/wiki/United_States_National_Grid))

### Install as an NPM Package

```javascript
npm install alphanumeric-encoder
```

### Use in Javascript

```javascript
const AlphanumericEncoder = require('alphanumeric-encoder')

const encoder = new AlphanumericEncoder()

console.log(encoder.encode(5)) // 'E'
console.log(encoder.encode(48)) // 'AV'
console.log(encoder.encode(733)) // 'ABE'

console.log(encoder.decode('A')) // 1
console.log(encoder.decode('AC')) // 29
console.log(encoder.decode('ANE')) // 1045

console.log(encoder.deconstruct('C7')) // [3, 7]
console.log(encoder.deconstruct('AC22')) // [29, 22]
console.log(encoder.deconstruct('C3ABC123EFGH456')) // [3, 3, 731, 123, 92126, 456]
```

---

## :gear: API Documentation

See the [API](/../../blob/main/API.md) for more detailed information on how to use the class.

## :hammer_and_wrench: Node and Operating System Support Policy

The test suite has successfully run on all combinations of:

-   [![Node Versions Supported](https://img.shields.io/node/v/alphanumeric-encoder)](https://github.com/nodejs/Release)
-   ![Windows Supported](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge=flat&logo=windows&logoColor=white)
    ![Mac Supported](https://img.shields.io/badge/Mac-000000?style=for-the-badge=flat&logo=apple&logoColor=white)
    ![Linux Supported](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge=flat&logo=linux&logoColor=black)

This project supports [Long-Term Support, Current, and Maintenance](https://github.com/nodejs/Release) versions of node. Once a version reaches end of life, the CI scripts will no longer support them. Odd Node versions will only receive support while in a current status.

Other Node versions and operating systems might support the library, but the tests have not verified other combinations.

---

## :clipboard: License and Development

`alphanumeric-encoder` and all other files in this repository are distributed as free and open-source software under the [MIT License](/../../blob/main/LICENSE), © 2022.

Both [contributions](/../../blob/main/CONTRIBUTING.md) and [bug reports](https://github.com/M-Scott-Lassiter/Alphanumeric-Encoder/issues/new/choose) welcome. See the [change log](/../../blob/main/CHANGELOG.md) for specific details of each release.

Leave a :star2: if you find this project useful!

</div>

## :envelope: Contact

Maintained by M. Scott Lassiter.

[![GitHub Badge Profile](https://img.shields.io/badge/GitHub-100000?style=plastic&logo=github&logoColor=white)](https://github.com/M-Scott-Lassiter)
[![Twitter Badge Profile](https://img.shields.io/badge/Twitter-1DA1F2?style=plastic&logo=twitter&logoColor=white)](https://twitter.com/MScottLassiter)
[![LinkedIn Badge Profile](https://img.shields.io/badge/LinkedIn-0077B5?style=plastic&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mscottlassiter)
[![Stackoverflow Badge Profile](https://img.shields.io/badge/stackoverflow-orange.svg?longCache=true&style=plastic&logo=stackoverflow&logoColor=white)](https://stackoverflow.com/users/6186333/sandpiper)

---
_Source: https://npm.io/package/alphanumeric-encoder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
