Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current isValid() is useless #51

Open
vanodevium opened this issue Mar 5, 2025 · 0 comments
Open

Current isValid() is useless #51

vanodevium opened this issue Mar 5, 2025 · 0 comments

Comments

@vanodevium
Copy link

vanodevium commented Mar 5, 2025

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant