How to use the email-addresses.parseOneAddress function in email-addresses

To help you get started, we’ve selected a few email-addresses examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glennjones / text-autolinker / lib / autolinker.js View on Github external
expanded: expanded
						});
					} else {
						out.url.push({
							match: word
						});
					}
					words[x] = '<a href="' + address + '" class="' + cn.auto + ' ' + cn.url + '">' + address + '</a>';
				}



			} else if (word.indexOf('@') &gt; 0 &amp;&amp; word.indexOf('.') &gt; 0) {

				// check email is valid
				var email = addrs.parseOneAddress(word);
				if (email) {
					delete email.parts;
					delete email.name;
					if (!out.email) {
						out.email = [];
					}
					out.email.push(email);
					words[x] = '<a href="mailto:' + email.address + '" class="' + cn.auto + ' ' + cn.email + '">' + word + '</a>';
				}

			} else if (word.indexOf('@') === 0) {

				if (!out.account) {
					out.account = [];
				}
				out.account.push({

email-addresses

An email address parser based on rfc5322

MIT
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis