function normalizeEmail(email) {
var emailParts = email.split(/@/);
var user = emailParts[0];
var domain = emailParts[1];
user.replace(/\./g, '');
user = user.split('+')[0];
return user + '@' + domain;
}
Not really...
Yahoo! has '-', not '+'
Which domains support '+'?
How about Google Apps for Work?
etc.
So let's search for a library
Only one written in JS...
with a bug on sight
1. Only now should we create our own
2. We should mention the Prior Art
"Prior Art"
"Prior art (state of the art or background art), [...], constitutes all information that has been made available to the public [...] that might be relevant to a patent's claims of originality."
Takeaways
Don't reinvent the wheel
If you do reinvent it, mention the Prior Art
Very few mention prior art
Why mention prior art
Shows you've done your research
Helps the user pick among alternatives
You can actually learn from your research - mistakes, pitfalls, features, APIs etc.