🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

uid2

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uid2

strong uid

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
3.1M
-2.29%
Maintainers
1
Weekly downloads
 
Created
Source

uid2

NPM version

Generate unique ids. Pass in a length and it returns a string.

Installation

npm install uid2

Examples

Without a callback it is synchronous:

const uid = require('uid2');

const id = uid(10);
// id => "hbswt489ts"

With a callback it is asynchronous:

const uid = require('uid2');

uid(10, function (err, id) {
  if (err) throw err;
  // id => "hbswt489ts"
});

Imported via uid2/promises it returns a Promise:

const uid = require('uid2/promises');

async function foo() {
  const id = await uid(10);
  // id => "hbswt489ts"
}

License

MIT

FAQs

Package last updated on 25 Aug 2021

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