Skip to content

isValid doesn't handle upper bound ULIDs #51

@vanodevium

Description

@vanodevium

This isValid() is really useless because it returns true for any string. In a nutshell, this method only checks the length and characters, but not the ulid format.

For example:

console.log(isValid('xxxxxxxxxxxxxxxxxxxxxxxxxx')); // => true

I think the following code would be more correct for validation:

/^[0-7][0-9a-hjkmnp-tv-z]{25}$/i.test(ulid);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions