uid2
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/uid2 package

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i uid2

Weekly Downloads

1,132,489

Version

1.0.0

License

MIT

Unpacked Size

5.57 kB

Total Files

7

Last publish

Collaborators

  • coreh