JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1633406
  • Score
    100M100P100Q194883F
  • License MIT

strong uid

Package Exports

  • uid2

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (uid2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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