emailjs-addressparser
Advanced tools
Comparing version 1.0.1 to 2.0.1
{ | ||
"name": "emailjs-addressparser", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/emailjs/emailjs-addressparser", | ||
"description": "Parse rfc2822 address fields", | ||
"author": "Andris Reinman <andris@kreata.ee>", | ||
"keywords": ["RFC822", "RFC2822", "mime", "address", "parser"], | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "grunt" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/emailjs/emailjs-addressparser.git" | ||
}, | ||
"main": "src/emailjs-addressparser", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"chai": "~1.8.1", | ||
"grunt": "~0.4.1", | ||
"grunt-mocha-phantomjs": "~0.4.0", | ||
"grunt-contrib-connect": "~0.6.0", | ||
"grunt-contrib-jshint": "~0.8.0", | ||
"grunt-mocha-test": "~0.8.1", | ||
"mocha": "~1.16.2", | ||
"phantomjs": "~1.9.7-1", | ||
"requirejs": "~2.1.10" | ||
} | ||
"name": "emailjs-addressparser", | ||
"version": "2.0.1", | ||
"homepage": "https://github.com/emailjs/emailjs-addressparser", | ||
"description": "Parse rfc2822 address fields", | ||
"author": "Andris Reinman <andris@kreata.ee>", | ||
"keywords": [ | ||
"RFC822", | ||
"RFC2822", | ||
"mime", | ||
"address", | ||
"parser" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "./scripts/build.sh", | ||
"release": "./scripts/release.sh", | ||
"lint": "$(npm bin)/standard", | ||
"test": "npm run lint && npm run unit", | ||
"unit": "$(npm bin)/mocha './src/*-unit.js' --reporter spec --require babel-register testutils.js", | ||
"test-watch": "$(npm bin)/mocha './src/*-unit.js' --reporter spec --require babel-register testutils.js --watch" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/emailjs/emailjs-addressparser.git" | ||
}, | ||
"main": "./src/addressparser", | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-register": "^6.26.0", | ||
"chai": "^4.1.2", | ||
"mocha": "^4.0.1", | ||
"nodemon": "^1.12.1", | ||
"pre-commit": "^1.2.2", | ||
"standard": "^10.0.3" | ||
}, | ||
"standard": { | ||
"globals": [ | ||
"describe", | ||
"it", | ||
"before", | ||
"beforeAll", | ||
"afterAll", | ||
"after", | ||
"expect" | ||
] | ||
} | ||
} |
@@ -1,11 +0,8 @@ | ||
# Address parser | ||
# Address Parser | ||
`emailjs-addressparser` is a UMD module that allows you to parse mime formatted e-mail address lists in node and the browser. | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/emailjs/emailjs-addressparser.svg)](https://greenkeeper.io/) [![Build Status](https://travis-ci.org/emailjs/emailjs-addressparser.png?branch=master)](https://travis-ci.org/emailjs/emailjs-addressparser) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![ES6+](https://camo.githubusercontent.com/567e52200713e0f0c05a5238d91e1d096292b338/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f65732d362b2d627269676874677265656e2e737667)](https://kangax.github.io/compat-table/es6/) | ||
NB! This module does not decode any mime-word or punycode encoded strings, it is only a basic parser for parsing the base data. | ||
[![Build Status](https://travis-ci.org/whiteout-io/addressparser.png?branch=master)](https://travis-ci.org/whiteout-io/addressparser) | ||
`emailjs-addressparser` allows you to parse mime formatted e-mail address lists. This module does not decode any mime-word or punycode encoded strings, it is only a basic parser for parsing the base data. | ||
## Installation | ||
## Usage | ||
@@ -17,48 +14,47 @@ | ||
### node.js and AMD | ||
### parse | ||
require('emailjs-addressparser'); | ||
``` | ||
import parse from "emailjs-addressparser" | ||
``` | ||
### Global context | ||
Parsing Addresses w/o groups: | ||
// exposes global variable addressparser | ||
<script src="emailjs-addressparser.js"></script> | ||
> `String -> [{name: String, address: String}]` | ||
### addressparser #parse() | ||
``` | ||
parse(('"Bach, Sebastian" <sebu@example.com>, mozart@example.com (Mozzie)') | ||
-> | ||
[{ | ||
name: "Bach, Sebastian", | ||
address: "sebu@example.com" | ||
}, { | ||
name: "Mozzie", | ||
address: "mozart@example.com" | ||
}] | ||
``` | ||
Parses a list of mime formatted e-mail addresses. Returned array includes objects in the form of `{name, address}`. If the address is a [group](http://tools.ietf.org/html/rfc2822#appendix-A.1.3), instead of `address` parameter, `group` parameter (array) with nested address objects is used. | ||
And when using groups | ||
addressparser.parse(addressString) -> String | ||
> `String -> [{name: String, group: [{name: String, address: String}]}]` | ||
For example: | ||
addressparser.parse(('"Bach, Sebastian" <sebu@example.com>, mozart@example.com (Mozzie)'); | ||
// returns | ||
[{ | ||
name: "Bach, Sebastian", | ||
address: "sebu@example.com" | ||
``` | ||
parse('Composers:"Bach, Sebastian" <sebu@example.com>, mozart@example.com (Mozzie);') | ||
-> | ||
[{ | ||
name: "Composers", | ||
group: [{ | ||
address: "sebu@example.com", | ||
name: "Bach, Sebastian" | ||
}, { | ||
name: "Mozzie", | ||
address: "mozart@example.com" | ||
address: "mozart@example.com", | ||
name: "Mozzie" | ||
}] | ||
}] | ||
``` | ||
And when using groups | ||
## License | ||
addressparser.parse('Composers:"Bach, Sebastian" <sebu@example.com>, mozart@example.com (Mozzie);'); | ||
The MIT License | ||
// returns | ||
[{ | ||
name: "Composers", | ||
group: [{ | ||
address: "sebu@example.com", | ||
name: "Bach, Sebastian" | ||
}, { | ||
address: "mozart@example.com", | ||
name: "Mozzie" | ||
}] | ||
}] | ||
## License | ||
Copyright (c) 2013 Andris Reinman | ||
@@ -65,0 +61,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
43832
8
13
719
0
78