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

Accept address lists with a trailing comma #12

Closed
bradvogel opened this issue Nov 9, 2014 · 4 comments
Closed

Accept address lists with a trailing comma #12

bradvogel opened this issue Nov 9, 2014 · 4 comments

Comments

@bradvogel
Copy link

Would be nice if the trailing comma was ignored and this worked:

$ npm install email-addresses
npm http GET https://registry.npmjs.org/email-addresses
npm http 304 https://registry.npmjs.org/email-addresses
email-addresses@2.0.1 node_modules/email-addresses
$ node
> var email = require('email-addresses')
undefined
> email.parseAddressList('Kysen Vogel <kysen.vogel@gmail.com>,')
null
@jackbearheart
Copy link
Owner

Can you tell me about the use case for this? What's the purpose and where do you get such email address lists from?

@bradvogel
Copy link
Author

I'm gathering email addresses by querying emails from the gmail api (to populate an autocomplete dropdown in my app). I'm using email-addresses to parse the value of the 'To' header. So these strange strings are valid emails per the gmail api. Hope that helps!

@zoellner
Copy link

zoellner commented Mar 6, 2018

I know this is an old issue but want to follow up on it.
I think what is needed here is an option to ignore invalid entries and still return the rest of the result.
i.e. addrs("valid@example.com") and addrs("valid@example.com, invalid") with that switch turned on would both return the same addresses array containing valid@example.com

@jackbearheart
Copy link
Owner

Cleaning up some old issues. Can do this with the partial option. addrs({partial: true, input: "valid@example.com, invalid"})

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