* Extract emails from list of elements * @param {NodeList } elements - A list of HTML elements to iteralte over * @param {Function} extract - extract function * @return {Array} The recipient objects in fhe form { email: 'jon@example.com' }
(elements, extract)
| 348 | * @return {Array} The recipient objects in fhe form { email: 'jon@example.com' } |
| 349 | */ |
| 350 | function parseEmail(elements, extract) { |
| 351 | const emails = []; |
| 352 | for (const element of elements) { |
| 353 | const parsed = parseAddressSafe(extract(element)); |
| 354 | if (parsed) { |
| 355 | emails.push(parsed.email); |
| 356 | } |
| 357 | } |
| 358 | return toRecipients(emails); |
| 359 | } |
| 360 | |
| 361 | /** |
| 362 | * Maps an array of email addresses to an array of recipient objects. |
no test coverage detected