-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Labels
Description
Hey there,
great work with superstruct. I was especially happy to see that it does not bloat the browser bundle like other validation libs do.
One thing is holding me back to switch to superstruct though,
I could not find an easy way to provide a custom error message.
I was looking for something as easy as
pattern(string(), /^\d\d\d\d-\d\d-\d\d$/, 'custom error message, the string should be in date format YYYY-MM-DD')
or
message(pattern(...), 'custom error message, the string should be in date format YYYY-MM-DD')
The default error message provides the regex used which is not something I would like to bother a user with and there are some other use cases like localization.
Is there a way to do that already?
Reactions are currently unavailable