edgeport - v1.0.6
    Preparing search index...

    Function parseEmailAddress

    • Parses an email address in either the bare (local@domain) or display-name (Display Name <local@domain>) form.

      Whitespace around the whole input, the display name, and the bracketed address is trimmed; a quoted display name ("Doe, John" <j@x>) is unquoted. When the input has no angle brackets the entire trimmed string is treated as the address. The domain is split on the last @, so it is absent for an address that contains no @ at all.

      Parameters

      • input: string

        The raw address string.

      Returns ParsedAddress

      The parsed ParsedAddress. address is always present (possibly empty); name and domain are present only when the input supplied them.

      1.0.4

      import { parseEmailAddress } from 'edgeport/util';

      parseEmailAddress('Ada Lovelace <ada@example.com>');
      // { name: 'Ada Lovelace', address: 'ada@example.com', local: 'ada', domain: 'example.com' }

      parseEmailAddress('ops@example.com');
      // { address: 'ops@example.com', local: 'ops', domain: 'example.com' }