npm short-unique-id 4.2.0
Release v4

latest releases: 5.2.0, 5.1.1, 5.1.0...
3 years ago

Fully functional and tested for Deno, Node.js, and Browsers.

BREAKING CHANGES

This project has been completely refactored from v3 to be less "Deno centric" and more good 'ol Typescript.

We tried avoiding breaking changes, and generally succeded.

With that said, for Node.js require use-cases:

  • The dist js files are now generated as UMD, named as ShortUniqueId, which means that...
// ...this
const { default: ShortUniqueId } = require('short-unique-id');

// must be refactored to this
const ShortUniqueId = require('short-unique-id');
  • The lib directory is now completely removed

Also, the following changes might generate errors in some edge-cases:

  • The short_uuid Deno submodule has been completely removed from this repo and now all the logic lives in src/index.ts
  • Typings are no longer under the typings directory but are now under the dist directory
  • A sourcemap is now included along with the dist files

New Feature 🥳

We have added the ability to generate UUIDs that contain a timestamp which can be extracted:

const uid = new ShortUniqueId();

const uidWithTimestamp = uid.stamp(32);
console.log(uidWithTimestamp);
// GDa608f973aRCHLXQYPTbKDbjDeVsSb3

console.log(uid.parseStamp(uidWithTimestamp));
// 2021-05-03T06:24:58.000Z

Don't miss a new short-unique-id release

NewReleases is sending notifications on new releases.