parse-email-address - v0.0.2
    Preparing search index...

    Function normalizeEmailAddress

    • 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.

      Parameters

      • emailAddress: undefined | string

      Returns undefined | string

      undefined if the given email address is invalid.

      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.