Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uuid-encoder

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uuid-encoder

Encode UUIDs into Base36 or any other system

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.6K
decreased by-9.47%
Maintainers
1
Weekly downloads
 
Created
Source

UUID Encoder

Convert UUIDs into Base32, Base36, or any other encoding of your choice.

Build Status Coverage Status Dependency Status Dev Dependency Status

Usage

const UuidEncoder = require('uuid-encoder');

// Create Base 36 encoder
const encoder = new UuidEncoder('base36');

// Encode an UUID
const encodedUuid = encoder.encode('38b9823d-fa1a-48e7-91fc-ee16ad091cf2');

// Decode an encoded UUID
const decodedUuid = encoder.decode(encodedUuid);

API

UuidEncoder([baseEncodingStr = 'base36'])

Instantiate a new encoder using the specified base encoder.

string encode(string uuid)

Returns a string containing the encoded version of the uuid.

string decode(string str)

Returns a string containing the decoded UUID from str.

Encoding

Built-In Encodings

TypeCharsetDescription
'base2'0-1Binary encoding
'base10'0-9Decimal encoding
'base16'0-9, a-fHexadecimal encoding
'base32'CustomCrockford's Base 32
'base36'0-9, a-zBase 36 (default)
'base58'CustomBitcoin Base 58
'base62'0-9, A-Z, a-zBase 62
'base64'0-9, A-Z, a-z, +, /Base 64
'base64url'0-9, A-Z, a-z, -, _Base 64 URL encoding (RFC 4648)

Custom Encoding

To use a different set or count of encoding characters, simply pass a string containing every desired letter to the constructor.

All custom encoding sets are case sensitive.

const encoder = new UuidEncoder('02468ACEGI'); // weird base10

Keywords

FAQs

Package last updated on 03 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc