Blame view
node_modules/addressparser/README.md
1.62 KB
f7563de62
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# addressparser Parse e-mail address fields. Input can be a single address (`"andris@kreata.ee"`), a formatted address (`"Andris Reinman <andris@kreata.ee>"`), comma separated list of addresses (`"andris@kreata.ee, andris.reinman@kreata.ee"`), an address group (`"disclosed-recipients:andris@kreata.ee;"`) 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 `"andris@kreata.ee; andris.reinman@kreata.ee"` is identical to `"andris@kreata.ee, andris.reinman@kreata.ee"`. ## Installation Install with npm ``` npm install addressparser ``` ## Usage Include the module ```javascript var addressparser = require('addressparser'); ``` Parse some address strings with `addressparser(field)` ```javascript var addresses = addressparser('andris <andris@tr.ee>'); console.log(addresses); // [{name: "andris", address:"andris@tr.ee"}] ``` And when using groups ```javascript addressparser('Composers:"Bach, Sebastian" <sebu@example.com>, mozart@example.com (Mozzie);'); ``` the result would be ``` [ { name: "Composers", group: [ { address: "sebu@example.com", name: "Bach, Sebastian" }, { address: "mozart@example.com", name: "Mozzie" } ] } ] ``` > Be prepared though that groups might be nested. ## Notes 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 ## License **MIT** |