Mandrake v0.0.2 Mandrake.Validation
Mandrake validation functions.
Summary
Functions
Returns true if the given value is a valid amount
Returns always true
Returns true if the given value is a valid email
Returns true if the given value is a valid gender (m/M, f/F)
Returns true if the given value is a valid hex
Returns true if the given value is a valid html tag
Returns true if the given value is a valid ip address
Returns true if the given value is a valid name
Returns true if the given value is a valid number
Returns true if the given value is a valid password (letters, numbers, underscores, hyphens, 6 < password_length < 18)
Returns true if the given value is a valid phone number
Returns true if the given value is a valid slug
Returns a function that test the given regex
Returns a boolean indicating whether there was a match or not
Returns true if the given value is a valid url
Returns true if the given value is a valid username (letters, numbers, underscores, hyphens, 3 < username_length < 18)
Returns true if the given value is a valid year
Functions
Returns true if the given value is a valid amount.
Examples
iex> Mandrake.Validation.amount("0")
true
iex> Mandrake.Validation.amount("0.00")
true
iex> Mandrake.Validation.amount("0,00")
true
Returns true if the given value is a valid email.
Examples
iex> Mandrake.Validation.email("foo@bar.com")
true
Returns true if the given value is a valid gender (m/M, f/F).
Examples
iex> Mandrake.Validation.gender("m")
true
Returns true if the given value is a valid hex.
Examples
iex> Mandrake.Validation.hex("#C0C0C0")
true
Returns true if the given value is a valid html tag.
Examples
iex> Mandrake.Validation.html("<a href='https://example.org'>My example link</a>")
true
Returns true if the given value is a valid ip address.
Examples
iex> Mandrake.Validation.ip_address("127.0.0.1")
true
Returns true if the given value is a valid name.
Examples
iex> Mandrake.Validation.name("Matteo Basso")
true
iex> Mandrake.Validation.name("Martin Luther King, Jr.")
true
Returns true if the given value is a valid number.
Examples
iex> Mandrake.Validation.number("535")
true
Returns true if the given value is a valid password (letters, numbers, underscores, hyphens, 6 < password_length < 18).
Examples
iex> Mandrake.Validation.password("Examplepassword")
true
Returns true if the given value is a valid phone number.
Examples
iex> Mandrake.Validation.phone_number("(123) 456 7899")
true
iex> Mandrake.Validation.phone_number("(123).456.7899")
true
iex> Mandrake.Validation.phone_number("(123)-456-7899")
true
iex> Mandrake.Validation.phone_number("123-456-7899")
true
iex> Mandrake.Validation.phone_number("123 456 7899")
true
iex> Mandrake.Validation.phone_number("1234567899")
true
Returns true if the given value is a valid slug.
Examples
iex> Mandrake.Validation.slug("my-example-tytle")
true
Returns a function that test the given regex.
Examples
iex> testFoo = Mandrake.Validation.test(~r/foo/)
...> testFoo.("bar")
false
Returns a boolean indicating whether there was a match or not.
Examples
iex> Mandrake.Validation.test(~r/foo/, "foo")
true
Returns true if the given value is a valid url.
Examples
iex> Mandrake.Validation.url("http://example.org/")
true
Returns true if the given value is a valid username (letters, numbers, underscores, hyphens, 3 < username_length < 18).
Examples
iex> Mandrake.Validation.username("mbasso")
true