-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi,
I'm a bit confused about how you work with 'options' as opposed to how the source library validator.js works with it. In particular, the function isMobilePhone defines 'locale' as one of the input parameters and 'options' as an object defaulting to {strictMode=false}. In your example however, you use options as a key with locale as a value:
mobile: {
isMobilePhone: {
options: 'en-GB',
errorMessage: 'Invalid mobile number.'
},
isAlphanumeric: true
}
Now what I want to achieve in this particular case is to validate that the value is a phone number with any locale, BUT the locale being mandatory. I could probably work around that using 'matches' validator or using a custom regex match, but it is more about the general principle of how to translate the source library input parameters to your API as this would be the case for many other validators.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels