Skip to content
Generating Human-readable Alphanumeric Identifiers
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE.txt
README.md
index.js
package.json
tests.js

README.md

npm version

Base36 id strings

This set of functions exists to convert various data types to and from base36 strings.

Why a base36 string?

  • Base36 strings are great way to shorten numeric ids for external applications. For example: 1000000 (1 million) converts down to LFLS.
  • Base36 strings are alphanumeric, using only commonly used letters and numbers
  • Base36 strings are case-insensitive

Where have I seen this before?

  • Microsoft product keys
  • Various HR software

Methods

uintToBase36(n) - convert a number to a base36 id string

uintFromBase36(s) - convert a base36 id string to a number

uintArrayToBase36(uints, segmentLength) - convert an array of numbers to a base36 id string at the specified segment length

uintArrayFromBase36(s, segmentLength) - convert a base36 id string to an array of numbers at the specified segment length

You can’t perform that action at this time.