Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: multiple emails #359

Closed
Skalkaz opened this issue Feb 7, 2015 · 4 comments
Closed

feature request: multiple emails #359

Skalkaz opened this issue Feb 7, 2015 · 4 comments

Comments

@Skalkaz
Copy link

Skalkaz commented Feb 7, 2015

Please implement comma separated email addresses.

@chriso
Copy link
Collaborator

chriso commented Feb 7, 2015

Why not just email_list.split(/, ?/) and then validate each email in the array?

@chriso
Copy link
Collaborator

chriso commented Feb 7, 2015

var validator = require('validator');

var emails = '[email protected], [email protected]'

var invalid_emails = emails.split(/, ?/).filter(function (email) {
    return !validator.isEmail(email);
});

if (invalid_emails.length) {
    // ...
}

@chriso chriso closed this as completed Feb 7, 2015
@Skalkaz
Copy link
Author

Skalkaz commented Feb 7, 2015

I just did something similar, but I thought it is general needs and this is the point of Validator. By the way, I also need to restrict the maximal number of emails, which is maybe too special problem.

@Vadorequest
Copy link

Having a helper to deal with multiple email addresses would be great, allow
to override the pattern via parameter would be better.

Checking a maximal amount of addresses shouldn't be in the same helper I
think, it is indeed too specific and would be hard to return a usable error.

2015-02-07 16:23 GMT+01:00 Skalkaz [email protected]:

I just did something similar, but I thought it is general needs and this
is the point of Validator. By the way, I also need to restrict the maximal
number of emails, which is maybe too special problem.


Reply to this email directly or view it on GitHub
#359 (comment).

Cordialement,

M. Ambroise Dhenain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants