normalize_email Build Status

Normalize emails for uniqueness validation. This will convert the email to lowercase, remove dots (.), and plus signs followed by arbitrary strings (+foobar).

Installation

Add normalize_email to your list of dependencies in mix.exs

def deps do
  [{:normalize_email, "~> 0.0.1"}]
end

Ensure normalize_email is started before your application

def application do
  [applications: [:normalize_email]]
end

Usage

NormalizeEmail.normalize_email("johnotander+foobar@gmail.com")
# => "johnotander@gmail.com"

NormalizeEmail.normalize_email("JOHN.OT.ander+OHAI@gmail.com")
# => "johnotander@gmail.com"

Development

mix test

Related

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander (@4lpine).