(address)
| 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). |
| 45 | export function parseAddressLoose(address) { |
| 46 | try { |
| 47 | const emailAddress = goog.format.EmailAddress.parse(address); |
| 48 | return { |
| 49 | email: emailAddress.isValid() ? emailAddress.getAddress() : '', |
| 50 | name: emailAddress.getName() || '' |
| 51 | }; |
| 52 | } catch { |
| 53 | return {email: '', name: ''}; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | export function parseAddressList(text) { |
| 58 | if (!text) { |
no outgoing calls
no test coverage detected