Normalizes an email address for string comparisons. It is discouraged to use the output of this for sending email as even the weird parts of a valid email address may be required for the user's specific email server to properly handle emails.
This uses canonicalize from smtp-address-parser v1.1.0 and converts the entire string to lowercase.
canonicalize
smtp-address-parser
undefined if the given email address is invalid.
undefined
import {normalizeEmailAddress} from 'parse-email-address';const result1 = normalizeEmailAddress('SIMPLE@EXAMPLE.ORG');// result1 is `'simple@example.org'`const result2 = normalizeEmailAddress('tld-too-short@foo.x');// result2 is `undefined` Copy
import {normalizeEmailAddress} from 'parse-email-address';const result1 = normalizeEmailAddress('SIMPLE@EXAMPLE.ORG');// result1 is `'simple@example.org'`const result2 = normalizeEmailAddress('tld-too-short@foo.x');// result2 is `undefined`
Nothing, this will never throw an error.
Normalizes an email address for string comparisons. It is discouraged to use the output of this for sending email as even the weird parts of a valid email address may be required for the user's specific email server to properly handle emails.
This uses
canonicalize
fromsmtp-address-parser
v1.1.0 and converts the entire string to lowercase.