https://github.com/devknown/alpha-id-js
Convert any integer to a short alphanumeric version.
https://github.com/devknown/alpha-id-js
alphanumeric alphanumeric-strings integer integer-to-alphanumeric number-converter
Last synced: 2 months ago
JSON representation
Convert any integer to a short alphanumeric version.
- Host: GitHub
- URL: https://github.com/devknown/alpha-id-js
- Owner: devknown
- License: mit
- Created: 2023-06-17T15:33:47.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-09T21:54:13.000Z (about 1 year ago)
- Last Synced: 2025-03-11T17:48:43.601Z (3 months ago)
- Topics: alphanumeric, alphanumeric-strings, integer, integer-to-alphanumeric, number-converter
- Language: TypeScript
- Homepage:
- Size: 48.8 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
AlphaID.js - Convert any integer to a short alphanumeric version
# AlphaID.js
AlphaID.js is a library that let you convert any integer to a short alphanumeric version. It can be useful for generating short, unique, and obfuscated identifiers.
## AlphaID Library Versions
These versions should all function harmoniously, allowing for encoding in one language and decoding in another.
- [PHP Version](https://github.com/devknown/alpha-id)
- [JavaScript Version](https://github.com/devknown/alpha-id-js)
- [Python Version](https://github.com/devknown/alpha-id-py)# Installation
You can install AlphaID.js using npm:
```bash
npm i alpha-id-js
```Via CDN:
```html
```
# Getting Started
Simple usage looks like:
```javascript
const AlphaID = require('alpha-id-js');
// or from browser ->const encodedString = AlphaID.convert(258456357951);
console.log(encodedString);
// Output: '4y7exoH'const originalNumber = AlphaID.recover('4y7exoH');
console.log(originalNumber);
// Output: 258456357951
```Configuring a Global Key
You can set a global key that will be used for encoding and decoding if no specific key is provided. This can be done using the `config` method:
```javascript
const AlphaID = require('alpha-id-js');AlphaID.config('my_key');
const encodedString = AlphaID.convert(258456357951);
console.log(encodedString);
// Output: '4ymMZq9'const originalNumber = AlphaID.recover('4ymMZq9');
console.log(originalNumber);
// Output: 258456357951
```## License
AlphaID is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).