-
-
Notifications
You must be signed in to change notification settings - Fork 890
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
Add isValid methods #85
Comments
For those wondering how to validate a UUID v4, the regex looks like this (in JS, but generally applicable): var id = "the id to test";
/^[a-z0-9]{8}-[a-z0-9]{4}-4[a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12}$/.test(id) |
@NatWeiss @tjconcept might want to take a look at validator, which will give you a lot more than just UUID validation. |
@tjconcept I agree, would be a nice addition to the library. |
@tjconcept @marbemac Although I understand the concern... I'm assuming you have to validate more than just UUIDs in your application... that being the case a common abstract for validation is probably better than a custom one for each type of data. |
Yeah, I like this idea! |
No I don't :) |
+1 |
I also think this would be a great idea and I also like the syntax suggested above: nodeUuid.isValid(input) I'd volunteer to add this feature |
+1 |
This is an old issue, but would be a great feature 👍 |
Hi Broofa, nice project here. ;) Just a suggestion. It would be nice if there was a method sort of like:
That way it would be easy to know if a string is a valid UUID v4. Right now, I have to resort to something janky like this:
The text was updated successfully, but these errors were encountered: