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

short-unique-id

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

short-unique-id

Generate random or sequential UUID of any length

  • 2.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
644K
decreased by-5.51%
Maintainers
1
Weekly downloads
 
Created

What is short-unique-id?

The short-unique-id npm package is a utility for generating short, unique, non-sequential ids. It is useful for creating unique identifiers for various purposes such as database keys, session tokens, and more.

What are short-unique-id's main functionalities?

Generate a unique ID

This feature allows you to generate a unique ID with the default settings. The generated ID is a short, unique string.

const ShortUniqueId = require('short-unique-id');
const uid = new ShortUniqueId();
console.log(uid());

Custom length of the ID

This feature allows you to specify the length of the generated ID. In this example, the ID will be 10 characters long.

const ShortUniqueId = require('short-unique-id');
const uid = new ShortUniqueId({ length: 10 });
console.log(uid());

Custom dictionary for ID generation

This feature allows you to use a custom dictionary for generating the ID. In this example, the ID will be generated using only hexadecimal characters.

const ShortUniqueId = require('short-unique-id');
const uid = new ShortUniqueId({ dictionary: '0123456789ABCDEF' });
console.log(uid());

Generate multiple unique IDs

This feature allows you to generate multiple unique IDs at once. In this example, an array of 5 unique IDs is generated.

const ShortUniqueId = require('short-unique-id');
const uid = new ShortUniqueId();
const ids = Array.from({ length: 5 }, () => uid());
console.log(ids);

Other packages similar to short-unique-id

Keywords

FAQs

Package last updated on 11 Mar 2020

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