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

short-uuid

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

short-uuid

Create and translate standard UUIDs with shorter formats.

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
108K
decreased by-59.82%
Maintainers
1
Weekly downloads
 
Created

What is short-uuid?

The short-uuid npm package is a utility for generating and working with short, URL-friendly UUIDs. It provides a way to encode and decode UUIDs into shorter formats, making them more suitable for use in URLs, database keys, and other contexts where a shorter identifier is beneficial.

What are short-uuid's main functionalities?

Generate Short UUID

This feature allows you to generate a new short UUID. The `short()` function creates a new translator instance, and `translator.new()` generates a new short UUID.

const short = require('short-uuid');
const translator = short();
const shortUUID = translator.new();
console.log(shortUUID);

Translate UUID to Short UUID

This feature allows you to convert a standard UUID to a short UUID. The `translator.fromUUID(uuid)` method takes a standard UUID and returns its shorter version.

const short = require('short-uuid');
const translator = short();
const uuid = '123e4567-e89b-12d3-a456-426614174000';
const shortUUID = translator.fromUUID(uuid);
console.log(shortUUID);

Translate Short UUID to UUID

This feature allows you to convert a short UUID back to a standard UUID. The `translator.toUUID(shortUUID)` method takes a short UUID and returns the original standard UUID.

const short = require('short-uuid');
const translator = short();
const shortUUID = 'SOME_SHORT_UUID';
const uuid = translator.toUUID(shortUUID);
console.log(uuid);

Custom Alphabet

This feature allows you to create a translator with a custom alphabet. The `short('0123456789abcdef')` function creates a new translator instance that uses the specified alphabet for encoding.

const short = require('short-uuid');
const customTranslator = short('0123456789abcdef');
const shortUUID = customTranslator.new();
console.log(shortUUID);

Other packages similar to short-uuid

Keywords

FAQs

Package last updated on 18 Oct 2018

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