ulid / javascript

Universally Unique Lexicographically Sortable Identifier

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is_ulid(x)

basaran opened this issue · comments

Hello, is there a validation / checking method provided with the library? Thank you.

was looking for that, would you mind give the answer if you found it?
basically want to check if a string match the ulid specs

is myString.replace(/[^a-z0-9]/gmi, '').length === 26 a correct way to detect ULID?

sorry nope, I suppose the reason there is no validation, because there is nothing to validate as long as the length is matching. There are some libraries on npm to extract time from the hash itself, but I think the reason people don't put much emphasis on these things is because it's not really required. From what I understand, the ulids are made to aid sorted db indexes mostly.