JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q59149F
  • License MIT

Base62 + big.js | Convert Strings an Numbers to Base62 without worrying about overflowing Number.MAX_SAFE_INTEGER

Package Exports

  • base-62.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (base-62.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

base-62.js

Circle CI npm version

#Getting started

###Install it

$ npm install base-62.js

###Require it

var base62 = require('base-62.js');

###Use it to convert a number to a base 62 string

base62.encode('144928238032487217698238462873470924850921348902347582734698872031234');
//=> "17BHYOc7KWVceLGi6QvVTM1OELAxTLd1EwAtmQW"

###Use it to come back

base62.decode('17BHYOc7KWVceLGi6QvVTM1OELAxTLd1EwAtmQW');
//=> "144928238032487217698238462873470924850921348902347582734698872031234"

###Create a portable token from a MongoDB Object id (or any HEX string)

base62.encodeHex('556c9e573337620003000000');
//=> "ynKPk8OoB7EzcAus"

base62.decodeHex('ynKPk8OoB7EzcAus')
//=> "556c9e573337620003000000"

###Create a random token (API Access or a random password)

base62.random()
//=> "jplADVZ4H8gYGRXGSbki8zBZsv5"