Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

26
node_modules/email-addresses/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,26 @@
language: node_js
env:
- CXX=g++-4.8
node_js:
- "4"
- "6"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
before_install:
- $CXX --version
- npm install node-gyp -g
before_script:
script:
- npm test
sudo: false

63
node_modules/email-addresses/Changes.md generated vendored Normal file
View file

@ -0,0 +1,63 @@
## 2019-10-24 - 3.1.0
- Added "atInDisplayName" option (#46)
- Added "comments" field to result mailbox (#46)
## 2018-11-09 - 3.0.3
- No changes
## 2018-09-21 - 3.0.2
- Fixed npe with rejectTLD option (#33)
## 2017-06-21 - 3.0.0
Note: There is a major version bump because of two things: changes to the typescript definition and changes to the results returned for "group" addresses.
- Full typescript definition (#30, a12b003)
- Fixed typescript "typings" field in package.json (#32)
- Proper results for groups (#31). Previously a "group" "address" would show its results as a single address, but it is now returned as a list. See the typescript definition for full return type.
- Support for parsing RFC6854 originator fields (#31). This adds new functions: parseFrom, parseSender, parseReplyTo. It also adds a new option "startAt". See source for possible values of "startAt".
## 2016-04-30 -
- minified version
## 2015-12-28 - 2.0.2
- Improves type definition #18
- Adds TypeScript definition file and declares in package.json #17
- remove inaccurate comment on obs-FWS
- add bower.json
## 2014-11-02 - 2.0.1
- properly parse unquoted names with periods (version 2.0.1)
## 2014-10-14 - 2.0.0
- add rejectTLD option, off by default
- add proper unicode support (rfc 6532)
- improve 'semantic interpretation' of names
## 2014-09-08 - 1.1.2
- document the return values more
- for 'address', 'local', and 'domain' convenience methods return semantic content
- update readme to show results from current code
- fix invalid reference to address node introduced in 51836f1
- support loading in the browser #4
# 2014-01-10 - 1.1.1
- return name and other fields with whitespace collapsed properly (closes #2)
- readme: add "why use this" and "installation"
- readme: link to @dominicsayers #1
## 2013-09-10 - 1.1.0
- Initial commit

19
node_modules/email-addresses/LICENSE generated vendored Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2013 Fog Creek Software
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

208
node_modules/email-addresses/README.md generated vendored Normal file
View file

@ -0,0 +1,208 @@
email-addresses.js
==================
An RFC 5322 email address parser.
v 3.1.0
What?
-----
Want to see if something could be an email address? Want to grab the display name or just the address out of a string? Put your regexes down and use this parser!
This library does not validate email addresses - we can't really do that without sending an email. However, it attempts to parse addresses using the (fairly liberal) grammar specified in RFC 5322. You can use this to check if user input looks like an email address.
Note carefully though - this parser supports all features of RFC 5322, which means that `"Bob Example" <bob@example.com>`
is a valid email address. If you just want to validate the `bob@example.com` part, that is RFC 5321, for which you want
to use something like node-address-rfc2821.
Why use this?
-------------
Use this library because you can be sure it really respects the RFC:
- The functions in the recursive decent parser match up with the productions in the RFC
- The productions from the RFC are written above each function for easy verification
- Tests include all of the test cases from the [is_email](https://github.com/dominicsayers/isemail) project, which are extensive
Installation
------------
npm install email-addresses
Example
-------
```
$ node
> addrs = require("email-addresses")
{ [Function: parse5322]
parseOneAddress: [Function: parseOneAddressSimple],
parseAddressList: [Function: parseAddressListSimple] }
> addrs.parseOneAddress('"Jack Bowman" <jack@fogcreek.com>')
{ parts:
{ name: [Object],
address: [Object],
local: [Object],
domain: [Object] },
name: 'Jack Bowman',
address: 'jack@fogcreek.com',
local: 'jack',
domain: 'fogcreek.com' }
> addrs.parseAddressList('jack@fogcreek.com, Bob <bob@example.com>')
[ { parts:
{ name: null,
address: [Object],
local: [Object],
domain: [Object] },
name: null,
address: 'jack@fogcreek.com',
local: 'jack',
domain: 'fogcreek.com' },
{ parts:
{ name: [Object],
address: [Object],
local: [Object],
domain: [Object] },
name: 'Bob',
address: 'bob@example.com',
local: 'bob',
domain: 'example.com' } ]
> addrs("jack@fogcreek.com")
{ ast:
{ name: 'address-list',
tokens: 'jack@fogcreek.com',
semantic: 'jack@fogcreek.com',
children: [ [Object] ] },
addresses:
[ { node: [Object],
parts: [Object],
name: null,
address: 'jack@fogcreek.com',
local: 'jack',
domain: 'fogcreek.com' } ] }
> addrs("bogus")
null
```
API
---
`obj = addrs(opts)`
===================
Call the module directly as a function to get access to the AST. Returns null for a failed parse (an invalid
address).
Options:
* `string` - An email address to parse. Parses as `address-list`, a list of email addresses separated by commas.
* `object` with the following keys:
* `input` - An email address to parse. Required.
* `rfc6532` - Enable rfc6532 support (unicode in email addresses). Default: `false`.
* `partial` - Allow a failed parse to return the AST it managed to produce so far. Default: `false`.
* `simple` - Return just the address or addresses parsed. Default: `false`.
* `strict` - Turn off features of RFC 5322 marked "Obsolete". Default: `false`.
* `rejectTLD` - Require at least one `.` in domain names. Default: `false`.
* `startAt` - Start the parser at one of `address-list`, `from`, `sender`, `reply-to`. Default: `address-list`.
Returns an object with the following properties:
* `ast` - the full AST of the parse.
* `addresses` - array of addresses found. Each has the following properties:
* `parts` - components of the AST that make up the address.
* `type` - The type of the node, e.g. `mailbox`, `address`, `group`.
* `name` - The extracted name from the email. e.g. parsing `"Bob" <bob@example.com>` will give `Bob` for the `name`.
* `address` - The full email address. e.g. parsing the above will give `bob@example.com` for the `address`.
* `local` - The local part. e.g. parsing the above will give `bob` for `local`.
* `domain` - The domain part. e.g. parsing the above will give `example.com` for `domain`.
Note if `simple` is set, the return will be an array of addresses rather than the object above.
Note that addresses can contain a `group` address, which in contrast to the `address` objects
will simply contain two properties: a `name` and `addresses` which is an array of the addresses in
the group. You can identify groups because they will have a `type` of `group`. A group looks
something like this: `Managing Partners:ben@example.com,carol@example.com;`
`obj = addrs.parseOneAddress(opts)`
===================================
Parse a single email address.
Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`.
Returns a single address object as described above. If you set `simple: false` the returned object
includes a `node` object that contains the AST for the address.
`obj = addrs.parseAddressList(opts)`
====================================
Parse a list of email addresses separated by comma.
Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`.
Returns a list of address objects as described above. If you set `simple: false` each address will
include a `node` object that containst the AST for the address.
`obj = addrs.parseFrom(opts)`
=============================
Parse an email header "From:" address (specified as mailbox-list or address-list).
Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`.
Returns a list of address objects as described above. If you set `simple: false` each address will
include a `node` object that containst the AST for the address.
`obj = addrs.parseSender(opts)`
===============================
Parse an email header "Sender:" address (specified as mailbox or address).
Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`.
Returns a single address object as described above. If you set `simple: false` the returned object
includes a `node` object that contains the AST for the address.
`obj = addrs.parseReplyTo(opts)`
================================
Parse an email header "Reply-To:" address (specified as address-list).
Operates identically to `addrs.parseAddressList(opts)`.
Usage
-----
If you want to simply check whether an address or address list parses, you'll want to call the following functions and check whether the results are null or not: ```parseOneAddress``` for a single address and ```parseAddressList``` for multiple addresses.
If you want to examine the parsed address, for example to extract a name or address, you have some options. The object returned by ```parseOneAddress``` has four helper values on it: ```name```, ```address```, ```local```, and ```domain```. See the example above to understand is actually returned. (These are equivalent to ```parts.name.semantic```, ```parts.address.semantic```, etc.) These values try to be smart about collapsing whitespace, quotations, and excluding RFC 5322 comments. If you desire, you can also obtain the raw parsed tokens or semantic tokens for those fields. The ```parts``` value is an object referencing nodes in the AST generated. Nodes in the AST have two values of interest here, ```tokens``` and ```semantic```.
```
> a = addrs.parseOneAddress('Jack Bowman <jack@fogcreek.com >')
> a.parts.name.tokens
'Jack Bowman '
> a.name
'Jack Bowman'
> a.parts.name.semantic
'Jack Bowman '
> a.parts.address.tokens
'jack@fogcreek.com '
> a.address
'jack@fogcreek.com'
> a.parts.address.semantic
'jack@fogcreek.com'
```
If you need to, you can inspect the AST directly. The entire AST is returned when calling the module's function.
References
----------
- http://tools.ietf.org/html/rfc5322
- https://tools.ietf.org/html/rfc6532
- https://tools.ietf.org/html/rfc6854
- http://code.google.com/p/isemail/
Props
-----
Many thanks to [Dominic Sayers](https://github.com/dominicsayers) and his documentation and tests
for the [is_email](https://github.com/dominicsayers/isemail) function which helped greatly in writing this parser.
License
-------
Licensed under the MIT License. See the LICENSE file.

29
node_modules/email-addresses/bower.json generated vendored Normal file
View file

@ -0,0 +1,29 @@
{
"name": "email-addresses",
"version": "3.1.0",
"homepage": "https://github.com/jackbearheart/email-addresses",
"authors": [
"Jack Bearheart <johnrbowman@fastmail.fm>"
],
"description": "An email address parser based on rfc5322",
"main": "./lib/email-addresses.js",
"moduleType": [
"globals",
"node"
],
"keywords": [
"email",
"address",
"parser",
"rfc5322",
"5322"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

107
node_modules/email-addresses/lib/email-addresses.d.ts generated vendored Normal file
View file

@ -0,0 +1,107 @@
declare module emailAddresses {
function parseOneAddress(input: string | Options): ParsedMailbox | ParsedGroup;
function parseAddressList(input: string | Options): (ParsedMailbox | ParsedGroup)[];
function parseFrom(input: string | Options): (ParsedMailbox | ParsedGroup)[];
function parseSender(input: string | Options): ParsedMailbox | ParsedGroup;
function parseReplyTo(input: string | Options): (ParsedMailbox | ParsedGroup)[];
interface ParsedMailbox {
node?: ASTNode;
parts: {
name: ASTNode;
address: ASTNode;
local: ASTNode;
domain: ASTNode;
comments: ASTNode[];
};
type: string;
name: string;
address: string;
local: string;
domain: string;
}
interface ParsedGroup {
node?: ASTNode;
parts: {
name: ASTNode;
};
type: string;
name: string;
addresses: ParsedMailbox[];
}
interface ASTNode {
name: string;
tokens: string;
semantic: string;
children: ASTNode[];
}
interface Options {
input: string;
oneResult?: boolean;
partial?: boolean;
rejectTLD?: boolean;
rfc6532?: boolean;
simple?: boolean;
startAt?: string;
strict?: boolean;
}
interface ParsedResult {
ast: ASTNode;
addresses: (ParsedMailbox | ParsedGroup)[];
}
}
declare function emailAddresses(opts: emailAddresses.Options): emailAddresses.ParsedResult;
declare module "email-addresses" {
export = emailAddresses;
}
/* Example usage:
// Run this file with:
// tsc test.ts && NODE_PATH="../emailaddresses/lib" node test.js
/// <reference path="../emailaddresses/lib/email-addresses.d.ts"/>
import emailAddresses = require('email-addresses');
function isParsedMailbox(mailboxOrGroup: emailAddresses.ParsedMailbox | emailAddresses.ParsedGroup): mailboxOrGroup is emailAddresses.ParsedMailbox {
return mailboxOrGroup.type === 'mailbox';
}
var testEmail : string = "TestName (a comment) <test@example.com>";
console.log(testEmail);
var parsed = emailAddresses.parseOneAddress(testEmail);
console.log(parsed);
var a : string = parsed.parts.name.children[0].name;
console.log(a);
if (isParsedMailbox(parsed)) {
var comment : string = parsed.parts.comments[0].tokens;
console.log(comment);
} else {
console.error('error, should be a ParsedMailbox');
}
//
var emailList : string = "TestName <test@example.com>, TestName2 <test2@example.com>";
console.log(emailList);
var parsedList = emailAddresses.parseAddressList(emailList);
console.log(parsedList);
var b : string = parsedList[1].parts.name.children[0].semantic;
console.log(b);
//
var parsedByModuleFxn = emailAddresses({ input: emailList, rfc6532: true });
console.log(parsedByModuleFxn.addresses[0].name);
*/

1090
node_modules/email-addresses/lib/email-addresses.js generated vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

30
node_modules/email-addresses/package.json generated vendored Normal file
View file

@ -0,0 +1,30 @@
{
"version": "3.1.0",
"name": "email-addresses",
"description": "An email address parser based on rfc5322",
"keywords": [
"email address",
"parser",
"rfc5322",
"5322"
],
"homepage": "https://github.com/jackbearheart/email-addresses",
"author": "Jack Bearheart <johnrbowman@fastmail.fm>",
"repository": {
"type": "git",
"url": "https://github.com/jackbearheart/email-addresses.git"
},
"directories": {
"lib": "./lib"
},
"main": "./lib/email-addresses.js",
"devDependencies": {
"libxmljs": "~0.19.7",
"tap": "^14.8.2"
},
"scripts": {
"test": "tap ./test"
},
"license": "MIT",
"typings": "./lib/email-addresses.d.ts"
}

369
node_modules/email-addresses/test/email-addresses.js generated vendored Normal file
View file

@ -0,0 +1,369 @@
var test = require("tap").test;
var addrs = require("../lib/email-addresses");
test("simple one address function", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
result = fxn("ABC < a@b.c>") || {};
t.notOk(result.node, "has no ast information");
t.equal(result.address, "a@b.c", "full address, semantic only");
t.equal(result.name, "ABC", "display name");
t.equal(result.local, "a", "local part");
t.equal(result.domain, "b.c", "domain");
t.equal(fxn("bogus"), null, "bogus address > null");
t.equal(fxn("a@b.c, d@e.f"), null, "address list > null");
result = fxn("\"Françoise Lefèvre\"@example.com");
t.ok(result, "RFC 6532 (Unicode support) is enabled by default");
t.equal(result.parts.local.semantic, "Françoise Lefèvre");
result = fxn("First Last <first@last.com>");
t.equal(result.name, "First Last",
"whitespace is not removed from display names without quotes");
result = fxn(" First Last <first@last.com>");
t.equal(result.name, "First Last",
"whitespace in names is collapsed");
t.end();
});
test("address with @ in the name", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
result = fxn({input: "ABC@abc (comment) < a@b.c>", atInDisplayName: true }) || {};
t.equal(result.name, "ABC@abc", "display name");
t.end();
});
test("address with comments", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
result = fxn("ABC (comment) < a@b.c>" ) || {};
t.equal(result.name, "ABC", "display name");
t.equal(result.comments, '(comment)');
t.end();
});
test("simple address list function", function (t) {
var fxn, result;
fxn = addrs.parseAddressList;
result = fxn("\"A B C\" < a@b.c>, d@e") || [{}, {}];
t.notOk(result[0].node, "has no ast information");
t.equal(result[0].address, "a@b.c", "full address, semantic only");
t.equal(result[0].name, "A B C", "display name");
t.equal(result[0].local, "a", "local part");
t.equal(result[0].domain, "b.c", "domain");
t.notOk(result[1].node, "has no ast information");
t.equal(result[1].address, "d@e", "second address");
t.equal(result[1].name, null, "second display name");
t.equal(result[1].local, "d", "second local part");
t.equal(result[1].domain, "e", "second domain");
t.equal(fxn("bogus"), null, "bogus address > null");
t.equal(fxn("a@b.c").length, 1, "single address > ok");
result = fxn("\"Françoise Lefèvre\"@example.com");
t.ok(result, "RFC 6532 (Unicode support) is enabled by default");
t.end();
});
test("rfc5322 parser", function (t) {
var fxn, result;
fxn = addrs;
result = fxn("\"A B C\" < a@b.c>, d@e") || {};
t.ok(result.ast, "has an ast");
t.ok(result.addresses.length, "has the addresses");
result = result.addresses;
t.ok(result[0].node, "has link to node in ast");
t.equal(result[0].address, "a@b.c", "full address, semantic only");
t.equal(result[0].name, "A B C", "display name");
t.equal(result[0].local, "a", "local part");
t.equal(result[0].domain, "b.c", "domain");
t.ok(result[1].node, "has link to node in ast");
t.equal(result[1].address, "d@e", "second address");
t.equal(result[1].name, null, "second display name");
t.equal(result[1].local, "d", "second local part");
t.equal(result[1].domain, "e", "second domain");
t.equal(fxn("bogus"), null, "bogus address > null");
t.equal(fxn("a@b bogus"), null, "not all input is an email list > null");
result = fxn({ input: "a@b bogus", partial: true });
t.ok(result, "can obtain partial results if at beginning of string");
result = fxn("\"Françoise Lefèvre\"@example.com");
t.notOk(result, "extended ascii characters are invalid according to RFC 5322");
result = fxn({ input: "\"Françoise Lefèvre\"@example.com", rfc6532: true });
t.ok(result, "but extended ascii is allowed starting with RFC 6532");
t.end();
});
test("display-name semantic interpretation", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
function check(s, comment, expected) {
t.equal(fxn(s).name, expected || "First Last", comment);
}
check(
"First<foo@bar.com>",
"single basic name is ok",
"First");
check(
"First Last<foo@bar.com>",
"no extra whitespace is ok");
check(
" First Last <foo@bar.com>",
"single whitespace at beginning and end is removed");
check(
"First Last<foo@bar.com>",
"whitespace in the middle is collapsed");
check(
" First Last <foo@bar.com>",
"extra whitespace everywhere is collapsed");
check(
" First Middle Last <foo@bar.com>",
"extra whitespace everywhere is collapsed, with more than 2 names",
"First Middle Last");
check(
"\tFirst \t Last\t<foo@bar.com>",
"extra whitespace everywhere is collapsed with a mix of tabs and spaces");
check(
"\"First Last\"<foo@bar.com>",
"surrounding quotes are not semantic");
check(
" \t \"First Last\" <foo@bar.com>",
"surrounding quotes are not semantic and whitespace is collapsed");
check(
" \t \"First \\\"The\t\tNickname\\\" Last\" <foo@bar.com>",
"surrounding quotes are not semantic, but inner quotes are, and whitespace is collapsed",
"First \"The Nickname\" Last");
t.end();
});
test("address semantic interpretation", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
function check(s, comment, expected) {
t.equal(fxn(s).address, expected || "foo@bar.com", comment);
}
check(
"foo@bar.com",
"plain address is ok");
check(
" foo@bar.com ",
"plain address with whitespace at beginning and end");
check(
"foo @bar.com",
"plain address with whitespace left of @ sign");
check(
"foo@ bar.com",
"plain address with whitespace right of @ sign");
// Technically, we should also be able to handle removing CFWS in
// a dot-atom (or more importantly, obs-domain), but I don't think anyone cares.
check(
"\t foo\t\t@ \t bar.com \t ",
"plain address with whitespace everywhere");
check(
"Bob <\t foo\t\t@ \t bar.com \t >",
"angle-addr with whitespace everywhere");
check(
"\"foo\"@bar.com",
"plain address with quoted-string local-part");
check(
"\"foo baz\"@bar.com",
"plain address with quoted-string local-part including spaces" +
" (Note: This is a confusing situation for 'semantic' local-parts, and" +
" in this case we don't return a valid address. Don't use this. Just" +
" take the raw tokens used for the address if you always want it to be equivalent.)",
"foo baz@bar.com");
t.end();
});
test("unicode support", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
result = fxn("\"Françoise Lefèvre\"@example.com");
t.ok(result, "extended ascii characters are allowed");
result = fxn("杨孝宇 <xiaoyu@example.com>");
t.ok(result, "unicode support includes chinese characters (display-name, no quoted string)");
result = fxn("\"杨孝宇\" <xiaoyu@example.com>");
t.ok(result, "unicode support includes chinese characters (display-name, quoted-string)");
t.end();
});
test("rejectTLD option", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
result = fxn({ input: "foo@bar.com", rejectTLD: false });
t.ok(result, "a simple address is ok (rejectTLD false)");
result = fxn({ input: "foo@bar.com", rejectTLD: true });
t.ok(result, "a simple address is ok (rejectTLD true)");
result = fxn({ input: "\"Foo Bar\" <foo@bar.com>", rejectTLD: false });
t.ok(result, "a more complicated address is ok (rejectTLD false)");
result = fxn({ input: "\"Foo Bar\" <foo@bar.com>", rejectTLD: true });
t.ok(result, "a more complicated address is ok (rejectTLD true)");
result = fxn({ input: "foo@bar", rejectTLD: false });
t.ok(result, "an address with a TLD for its domain is allowed by rfc 5322");
result = fxn({ input: "foo@bar", rejectTLD: true });
t.notOk(result, "an address with a TLD for its domain is rejected when the option is set");
result = fxn({ input: "\"Foo Bar\" <foo@bar>", rejectTLD: false });
t.ok(result, "a more complicated address with a TLD for its domain is allowed by rfc 5322");
result = fxn({ input: "\"Foo Bar\" <foo@bar>", rejectTLD: true });
t.notOk(result, "a more complicated address with a TLD for its domain is rejected when the option is set");
result = fxn({ input: "jack@", rejectTLD: true });
t.notOk(result, "no domain is ok with rejectTLD set");
t.end();
});
test("dots in unquoted display-names", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
result = fxn("H.P. Lovecraft <foo@bar.net>");
t.ok(result, "dots in the middle of an unquoted display-name with spaces (obs-phrase production)");
result = fxn("Hmm Yes Info. <foo@bar.net>");
t.ok(result, "dots to end an unquoted display-name (obs-phrase production)");
result = fxn("bar.net <foo@bar.net>");
t.ok(result, "dots in the middle of an unquoted display-name without spaces (obs-phrase production)");
result = fxn({ input: "H.P. Lovecraft <foo@bar.net>", strict: true });
t.notOk(result, "dots without using 'obsolete' productions");
result = fxn({ input: "Hmm Yes Info. <foo@bar.net>", strict: true });
t.notOk(result, "dots without using 'obsolete' productions");
result = fxn({ input: "bar.net <foo@bar.net>", strict: true });
t.notOk(result, "dots without using 'obsolete' productions");
t.end();
});
test("rfc6854 - from", function (t) {
var fxn, result;
fxn = addrs.parseFrom;
result = fxn("Managing Partners:ben@example.com,carol@example.com;");
t.ok(result, "Parse group for From:");
t.equal(result[0].name, "Managing Partners", "Extract group name");
t.equal(result[0].addresses.length, 2, "Extract group addresses");
t.equal(result[0].addresses[0].address, "ben@example.com", "Group address 1");
t.equal(result[0].addresses[1].address, "carol@example.com", "Group address 1")
result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" <foo@example.com>");
t.ok(result, "Group and mailbox");
t.equal(result[0].name, "Managing Partners", "Extract group name");
t.equal(result[1].name, "Foo", "Second address name");
t.equal(result[1].local, "foo", "Second address local");
t.equal(result[1].domain, "example.com", "Second address domain");
t.end();
});
test("rfc6854 - sender", function (t) {
var fxn, result;
fxn = addrs.parseSender;
result = fxn("Managing Partners:ben@example.com,carol@example.com;");
t.ok(result, "Parse group for Sender:");
t.equal(result.length, undefined, "Result is not an array");
t.equal(result.name, "Managing Partners", "Result has name");
t.equal(result.local, undefined, "Result has no local part");
t.equal(result.addresses.length, 2, "Result has two addresses");
t.equal(result.addresses[0].address, "ben@example.com", "Result first address match");
t.equal(result.addresses[1].address, "carol@example.com", "Result first address match");
t.end();
});
test("rfc6854 - reply-to", function (t) {
var fxn, result;
fxn = addrs.parseReplyTo;
result = fxn("Managing Partners:ben@example.com,carol@example.com;");
t.ok(result, "Parse group for Reply-To:");
t.equal(result[0].name, "Managing Partners", "Extract group name");
t.equal(result[0].addresses.length, 2, "Extract group addresses");
t.equal(result[0].addresses[0].address, "ben@example.com", "Group address 1");
t.equal(result[0].addresses[1].address, "carol@example.com", "Group address 1")
result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" <foo@example.com>");
t.ok(result, "Group and mailbox");
t.equal(result[0].name, "Managing Partners", "Extract group name");
t.equal(result[1].name, "Foo", "Second address name");
t.equal(result[1].local, "foo", "Second address local");
t.equal(result[1].domain, "example.com", "Second address domain");
result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" <foo@example.com>, Group2:alice@example.com;");
t.ok(result, "Group, mailbox, group");
t.equal(result[0].name, "Managing Partners", "First: group name");
t.equal(result[0].addresses[0].address, "ben@example.com");
t.equal(result[0].addresses[1].address, "carol@example.com");
t.equal(result[1].name, "Foo", "Second: address name");
t.equal(result[2].name, "Group2", "Third: group name");
t.end();
});
test("whitespace in domain", function (t) {
var fxn, result;
fxn = addrs.parseOneAddress;
result = fxn('":sysmail"@ Some-Group. Some-Org');
t.ok(result, "spaces in domain parses ok");
t.equal(result.domain, "Some-Group.Some-Org", "domain parsing strips whitespace");
t.end();
})

87
node_modules/email-addresses/test/is_email.js generated vendored Normal file
View file

@ -0,0 +1,87 @@
var fs = require("fs"),
libxmljs = require("libxmljs"),
test = require("tap").test;
var addrs = require("../lib/email-addresses");
var TESTS_FILE = "tests.xml",
TESTS_FILE_ENCODING = "utf8";
var ISEMAIL_ERR = "ISEMAIL_ERR",
ISEMAIL_ERR_DOMAINHYPHENSTART = "ISEMAIL_ERR_DOMAINHYPHENSTART",
ISEMAIL_ERR_DOMAINHYPHENEND = "ISEMAIL_ERR_DOMAINHYPHENEND";
function isEmailTest(t, data) {
var nodes = getNodes(data, "//test");
nodes.forEach(function (node) {
var id = getAttr(node, "id"),
address = getChildValue(node, "address"),
diagnosis = getChildValue(node, "diagnosis");
var result = addrs(convertAddress(address)),
ast = null;
if (result !== null) {
ast = result.addresses[0].node;
}
var isValid = ast !== null,
expectedToBeValid = shouldParse(diagnosis);
t.equal(isValid, expectedToBeValid,
"[test " + id + "] address: " + address + ", expects: " + expectedToBeValid);
});
t.end();
}
function shouldParse(diagnosis) {
var isOk = !startsWith(diagnosis, ISEMAIL_ERR) ||
// is_email considers address with a domain beginning
// or ending with "-" to be incorrect because they are not
// valid domains, but we are only concerned with rfc5322.
// From rfc5322's perspective, this is OK.
diagnosis === ISEMAIL_ERR_DOMAINHYPHENSTART ||
diagnosis === ISEMAIL_ERR_DOMAINHYPHENEND;
return isOk;
}
// the is_email tests encode control characters
// in the U+2400 block for display purposes
function convertAddress(s) {
var chars = [];
for (var i = 0; i < s.length; i += 1) {
var code = s.charCodeAt(i);
if (code >= 0x2400) {
code -= 0x2400;
}
chars.push(String.fromCharCode(code));
}
return chars.join('');
}
function getChildValue(parent, nodeName) {
return parent.find(nodeName)[0].text();
}
function getAttr(node, attrName) {
return node.attr(attrName).value();
}
function getNodes(xml, xpath) {
var doc = libxmljs.parseXml(xml);
return doc.find(xpath);
}
function startsWith(s, t) {
return s.substring(0, t.length) === t;
}
test("isemail tests", function (t) {
fs.readFile(TESTS_FILE, TESTS_FILE_ENCODING, function (err, data) {
if (err) {
t.end();
return console.error(err);
}
isEmailTest(t, data);
});
});

1253
node_modules/email-addresses/test/tests.xml generated vendored Normal file

File diff suppressed because it is too large Load diff