simplyhexagonal / short-unique-id

Short Unique ID (UUID) generation library. Available in NPM.

Home Page:https://www.npmjs.com/package/short-unique-id

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validate UUID

irfancnk opened this issue · comments

Hi, is there a way to validate whether a given string is valid UUID, according to its generator, if not, is it possible to add that as a new feature?

Version 5 was just released. It has better dictionary handling, thus would make it simple to validate that a short UID contains only characters from a given dictionary.

For this validation to work there would be two assumptions made:

  • You know the original dictionary the UID was generated with
  • The ShortUniqueId instance performing the validation is using the original dictionary, or the validate() function can be told which dictionary to validate against

We will explore implementing this functionality in the following weeks and update this issue as we progress.

Thanks for your contribution @irfancnk 👍🏼

This feature has been implemented, you can find the documentation at:

https://shortunique.id/#md:ability-to-validate-uuids-against-the-instance-dictionary-or-a-provided-dictionary

Cheers ✌🏼