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 asShortUniqueId
, 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 insrc/index.ts
- Typings are no longer under the
typings
directory but are now under thedist
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