1.3.11 • Published 7 months ago

base62-ts v1.3.11

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

base62-ts

Custom Base-62 Encoder

GitHub tag (latest by date) GitHub last commit GitHub issues npm NPM

This repository contains the version of my encoder/decoder for Base-62 in two languages:

Motivation

I needed an efficient way to apply a Base-62 encoding/decoding algorithm working the same way in TypeScript/Javascript and in Golang environments.

Usage

Both versions use the same following dictionary:

ValueCharacterValueCharacterValueCharacterValueCharacterValueCharacter
0013d26q39D52Q
1114e27r40E53R
2215f28s41F54S
3316g29t42G55T
4417h30u43H56U
5518i31v44I57V
6619j32w45J58W
7720k33x46K59X
8821l34y47L60Y
9922m35z48M61Z
10a23n36A49N
11b24o37B50O
12c25p38C51P

In other words, they use the following base: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.

npm i base62-ts
import * as base62 from 'base62-ts'

const value = 18969

const encoded = base62.encode(value)

// 4VX
console.log(encoded)

const decoded = base62.decode(encoded)

console.assert(value === decoded)

Dependencies

base62-ts depends on my general utility library for computing euclidean division: ts-utls.

Besides, to run the tests, you would need to install live-server:

npm i -g live-server

NB: Tests run on port 10001, beware if another process runs on the same port as such a conflict may disable them.

License

Both versions are available under a MIT license (see LICENSE).

1.3.10

7 months ago

1.3.11

7 months ago

1.3.9

8 months ago

1.3.8

8 months ago

1.3.7

11 months ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.11

2 years ago

1.2.9

2 years ago

1.2.10

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.2.1

4 years ago

0.1.1

4 years ago