JSPM

  • Created
  • Published
  • Downloads 1102488
  • Score
    100M100P100Q178439F

Short unique id generator. Url-friendly. Non-predictable. Cluster-compatible.

Package Exports

  • shortid

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 (shortid) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ShortId Build Status

ShortId is a tiny id generator good for creating guarenteed unique ids that are easier to use in urls and for sharing than UUID's.

  • 8-12 characters
  • Non-sequential so they are not predictable.
  • Random alphabet based on a seed you provide so others can't decrypt them.
  • Includes version in case you want to change how you encode your id.
  • Includes cluster worker id so you can use this on multi-processor server instances.
  • Includes tests that run on Mocha.

ShortId.generate() returns id

Other functions (docs coming soon)

  • ShortId.version(int) sets version, returns ShortId
  • ShortId.worker(int) sets cluster worker, returns ShortId

See the tests for more examples.