Skip to content

Options #8

@ZikmundKorybutovic

Description

@ZikmundKorybutovic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions