MCPcopy
hub / github.com/mailvelope/mailvelope / parseAddressSafe

Function parseAddressSafe

src/lib/email.js:31–41  ·  view source on GitHub ↗
(address)

Source from the content-addressed store, hash-verified

29}
30
31export function parseAddressSafe(address) {
32 try {
33 const emailAddress = goog.format.EmailAddress.parse(address);
34 if (!emailAddress.isValid()) {
35 return null;
36 }
37 return {email: emailAddress.getAddress(), name: emailAddress.getName()};
38 } catch {
39 return null;
40 }
41}
42
43// Never returns null. email is '' for invalid input. Used by callers that need
44// the parsed name even when the address is invalid (e.g. OpenPGP user IDs).

Callers 4

email.test.jsFile · 0.90
setRecipientsMethod · 0.90
parseEmailFunction · 0.90
parseAddressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected