uuid-base64-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

uuid-base64-ts

Shorten a UUID v4 to 22 characters with base64 encoding in Typescript

NPM npm bundle size (scoped) npm bundle size (scoped version) Libraries.io dependency status for latest release, scoped npm package NPM

Table of Contents

Installation

This library is available through the npm registry.

NPM

$ npm -i uuid-base64-ts

Yarn

$ yarn add uuid-base64-ts

Setup

Start using it by importing the library first.

CommonJS

const base64 = require('uuid-base64-ts');

or

ES6

import { encode, decode } from 'uuid-base64-ts';

Usage

Shorten a UUID v4 to 22 characters with base64 encoding

import { encode } from 'uuid-base64-ts';

const uuidv4 = '85c39545-533c-4587-bb1d-bad766908b1b';
const shortId = encode(uuidv4);

console.log(shortId);
// => 'hcOVRVM8RYe7HbrXZpCLGw'

Expand a base64 encoded character to UUID v4

import { decode } from 'uuid-base64-ts';

const shortId = 'hcOVRVM8RYe7HbrXZpCLGw';
const uuidv4 = decode(shortId);

console.log(uuidv4);
// => '85c39545-533c-4587-bb1d-bad766908b1b'

Authors

See also the list of contributors who participated in this project.

Changelog

Changelog

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i uuid-base64-ts

Weekly Downloads

342

Version

1.0.2

License

MIT

Unpacked Size

14.9 kB

Total Files

28

Last publish

Collaborators

  • princedev