Skip to content

Release v4

Compare
Choose a tag to compare
@jeanlescure jeanlescure released this 04 May 03:16
· 107 commits to main since this release

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