UNPKG
get-emails
Version:
latest (5.0.0)
5.0.0
4.0.0
3.0.0
2.1.0
2.0.0
1.0.1
1.0.0
Get all email addresses in a string
github.com/sindresorhus/get-emails
sindresorhus/get-emails
get-emails
/
index.js
7 lines
(5 loc)
•
195 B
JavaScript
View Raw
1
2
3
4
5
6
7
import
emailRegex
from
'email-regex'
;
export
default
function
getEmails
(
string
) {
const
emails =
string
.
match
(
emailRegex
());
return
new
Set
(emails ? emails.
map
(
email
=>
email.
trim
()) : []); }