Skip to content

Commit

Permalink
Improve the example function
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceful-james committed Jun 3, 2021
1 parent f23aeef commit cbe70ed
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,11 @@ Here is an example function to check if an email is valid:
@spec is_valid?(String.t()) :: true | {false, String.t()}
def is_valid?(email) do
case email_domain(email) do
[_ | [domain]] ->
case domain in @good_email_domains do
true ->
true
[_ | [domain]] when domain in @good_email_domains ->
true

false ->
is_not_burner?(email, domain)
end
[_ | [domain]] ->
is_not_burner?(email, domain)

_ ->
{false, "Email in bad format"}
Expand Down

0 comments on commit cbe70ed

Please sign in to comment.