JSPM

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

Base62 non-sequential url-safe UUID generator (RFC4122)

Package Exports

  • uuid62

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 (uuid62) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm version CircleCI Dependency Status

uuid62

Base-62 non-sequential url-friendly UUID generator (RFC4122).

Forked from dmarcelino with updated dependencies.

Overview

uuid62 makes it easy to generate short base-62 (or any other base) UUIDs. The unencoded UUIDs are generated by uuid which follows RFC4122. The encoded UUIDs are alphanumeric [0-9a-zA-Z] and always have a length of 22 chars.

Installation

npm i uuid62

Usage

const uuid62 = require('uuid62');

const uuid = uuid62.v4();
// -> 2qY9COoAhfMrsH7mCyh86T

// decode a base-62 uuid
const originalUUID = uuid62.decode(uuid);
// -> 9af099b2-6244-4fc1-b72b-1d69a24481b7

// base-62 encode an existing traditional uuid
const encoded = uuid62.encode('8fc60e7c-3b3c-48e9-a6a7-a5fe4f1fbc31');
// -> 2fNwVYePN8WqqDFvVf7XMN

uuid62 can also support other bases, example for base-64, by passing a new baseX charset to customBase:

uuid62.customBase = new uuid62.baseX("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_");
const uuid = uuid62.v4();
// -> 31LoSI_BVeQpXtwu_-GEbL

License

MIT