Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Normalize +, . in emails
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 2, 2020
1 parent 3253de5 commit c401a33
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/helpers/safe-email.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import normalize from 'normalize-email';

/**
* Converts an email address to a unqiue, safe email
* @param email - Valid email address
*/
export const safeEmail = (input: string) => {
const [user, domain] = input.split('@');
return `${user.split('+')[0]}@${domain}`.toLowerCase();
return normalize(input.toLowerCase().trim());
};

0 comments on commit c401a33

Please sign in to comment.