jackbearheart/email-addresses

Misses an option to allow domains without extension

Closed this issue · 2 comments

While the format user@example is a valid email address (ref. http://en.wikipedia.org/wiki/Email_address#Valid_email_addresses)
it would be useful to have an option to mark that as invalid, specially in production environments.

Thanks for the request. That seems reasonable.

I've added this option in d78346e. It's off by default for the reason that you noted: those are technically valid email addresses.

You can use it like addrs.parseOneAddress({ input: "user@example", rejectTLD: true }) . You could use a function that passed rejectTLD: true in your application instead of directly calling addrs.parseOneAddress.

Let me know if you have any other problems.

Cool thanks