Skip to content

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