node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



Parse e-mail address fields. Input can be a single address (""), a formatted address ("Andris Reinman <>"), comma separated list of addresses (","), an address group (";") or a mix of all the formats.

In addition to comma the semicolon is treated as the list delimiter as well (except when used in the group syntax), so a value ";" is identical to ",".


Install with npm

npm install addressparser


Include the module

var addressparser = require('addressparser');

Parse some address strings with addressparser(field)

var addresses = addressparser('andris <>');
console.log(addresses); // [{name: "andris", address:""}] 

And when using groups

addressparser('Composers:"Bach, Sebastian" <>, (Mozzie);');

the result would be

        name: "Composers",
        group: [
                address: "",
                name: "Bach, Sebastian"
                address: "",
                name: "Mozzie"

Be prepared though that groups might be nested.


This module does not decode any mime-word or punycode encoded strings, it is only a basic parser for parsing the base data, you need to decode the encoded parts later by yourself