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

Allow to pass options to validate UUID #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Yamilquery
Copy link

It allows passing options through the Vex validators

  • allow_nil
  • allow_blank
  • format
  • message

etc...

It allows passing options through the Vex validators
- allow_nil
- allow_blank
- format
- message

etc...
Comment on lines +4 to +9
def validate(value, options) do
options = if Keyword.keyword?(options) do
Keyword.merge([function: &valid_uuid?/1], options)
else
[function: &valid_uuid?/1, allow_nil: false, allow_blank: false]
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def validate(value, options \\ [allow_nil: false, allow_blank: false]) do
  options = options
  |> Keyword.merge([function: &valid_uuid?/1])

Would this be a nicer way to write it?

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

Successfully merging this pull request may close these issues.

2 participants