email-forward-parser 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/test.yml +40 -0
- package/LICENSE +2 -2
- package/README.md +5 -4
- package/lib/parser.js +7 -7
- package/package.json +4 -3
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
on: [push, pull_request]
|
|
2
|
+
|
|
3
|
+
name: Test and Build
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
strategy:
|
|
8
|
+
matrix:
|
|
9
|
+
os: [ubuntu-latest]
|
|
10
|
+
node-version: [10.x, 12.x, 14.x, 16.x]
|
|
11
|
+
fail-fast: false
|
|
12
|
+
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v2
|
|
18
|
+
|
|
19
|
+
- name: Install NodeJS
|
|
20
|
+
uses: actions/setup-node@v1
|
|
21
|
+
with:
|
|
22
|
+
node-version: ${{ matrix.node-version }}
|
|
23
|
+
|
|
24
|
+
- name: Verify versions
|
|
25
|
+
run: node --version && npm --version && node -p process.versions.v8
|
|
26
|
+
|
|
27
|
+
- name: Cache build artifacts
|
|
28
|
+
id: cache-node
|
|
29
|
+
uses: actions/cache@v2
|
|
30
|
+
with:
|
|
31
|
+
path: |
|
|
32
|
+
~/.npm
|
|
33
|
+
node_modules
|
|
34
|
+
key: ${{ runner.os }}-node-${{ matrix.node-version }}
|
|
35
|
+
|
|
36
|
+
- name: Install dependencies
|
|
37
|
+
run: npm install
|
|
38
|
+
|
|
39
|
+
- name: Run tests
|
|
40
|
+
run: npm test
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2021 Crisp
|
|
3
|
+
Copyright (c) 2021 Crisp IM SARL
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Email Forward Parser
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/email-forward-parser) [](https://www.npmjs.com/package/email-forward-parser)
|
|
3
|
+
[](https://github.com/crisp-oss/email-forward-parser/actions?query=workflow%3A%22Test+and+Build%22) [](https://www.npmjs.com/package/email-forward-parser) [](https://www.npmjs.com/package/email-forward-parser)
|
|
4
4
|
|
|
5
5
|
Parses forwarded emails and extracts original content.
|
|
6
6
|
|
|
7
7
|
This library supports most common email clients and locales.
|
|
8
8
|
|
|
9
|
+
**😘 Maintainer**: [@eliottvincent](https://github.com/eliottvincent)
|
|
10
|
+
|
|
9
11
|
## Who uses it?
|
|
10
12
|
|
|
11
13
|
<table>
|
|
@@ -90,5 +92,4 @@ npm test
|
|
|
90
92
|
|
|
91
93
|
## License
|
|
92
94
|
|
|
93
|
-
email-forward-parser is released under the MIT License. See the bundled LICENSE
|
|
94
|
-
file for details.
|
|
95
|
+
email-forward-parser is released under the MIT License. See the bundled LICENSE file for details.
|
package/lib/parser.js
CHANGED
|
@@ -393,9 +393,9 @@ class Parser {
|
|
|
393
393
|
|
|
394
394
|
// Attempt second method?
|
|
395
395
|
// Notice: as this second method is more uncertain (we split via the From \
|
|
396
|
-
//
|
|
397
|
-
// attempt it. The `forwarded` boolean gives the confirmation that the
|
|
398
|
-
//
|
|
396
|
+
// part, without further verification), we have to be sure we can \
|
|
397
|
+
// attempt it. The `forwarded` boolean gives the confirmation that the \
|
|
398
|
+
// email was indeed forwarded (detected from the Subject part)
|
|
399
399
|
if (forwarded === true) {
|
|
400
400
|
// Second method: split via the Form part (New Outlook 2019)
|
|
401
401
|
_match = loopRegexes(this.__regexes.original_from, _body, "split");
|
|
@@ -481,7 +481,7 @@ class Parser {
|
|
|
481
481
|
__parseOriginalBody(text) {
|
|
482
482
|
var _match = null;
|
|
483
483
|
|
|
484
|
-
// First method: extract the text after the Cc, To or Reply-To part
|
|
484
|
+
// First method: extract the text after the Cc, To or Reply-To part \
|
|
485
485
|
// (Apple Mail, Gmail) or after the Subject part (Outlook Live)
|
|
486
486
|
var _regexes = [
|
|
487
487
|
this.__regexes.original_subject,
|
|
@@ -500,7 +500,7 @@ class Parser {
|
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
-
// Second method: extract the text after the Subject part
|
|
503
|
+
// Second method: extract the text after the Subject part \
|
|
504
504
|
// (New Outlook 2019, Yahoo Mail)
|
|
505
505
|
_match = loopRegexes(
|
|
506
506
|
this.__regexes.original_subject.concat(
|
|
@@ -647,7 +647,7 @@ class Parser {
|
|
|
647
647
|
* @return {object} The parsed carbon-copy recipient(s)
|
|
648
648
|
*/
|
|
649
649
|
__parseOriginalCc(text) {
|
|
650
|
-
// First method: extract the carbon-copy recipient(s) via the Cc part
|
|
650
|
+
// First method: extract the carbon-copy recipient(s) via the Cc part \
|
|
651
651
|
// (Apple Mail, Gmail, Outlook Live, New Outlook 2019, Thunderbird)
|
|
652
652
|
var _recipients = this.__parseMailbox(
|
|
653
653
|
this.__regexes.original_cc,
|
|
@@ -764,7 +764,7 @@ class Parser {
|
|
|
764
764
|
* @return {string} The parsed subject
|
|
765
765
|
*/
|
|
766
766
|
__parseOriginalSubject(text) {
|
|
767
|
-
// First method: extract the subject via the Subject part (Apple Mail,
|
|
767
|
+
// First method: extract the subject via the Subject part (Apple Mail, \
|
|
768
768
|
// Gmail, Outlook Live, New Outlook 2019, Thunderbird)
|
|
769
769
|
var _match = loopRegexes(this.__regexes.original_subject, text);
|
|
770
770
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "email-forward-parser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Parses forwarded emails and extract content",
|
|
5
5
|
"author": "Eliott Vincent <eliott@crisp.chat>",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
|
+
"homepage": "https://github.com/crisp-oss/email-forward-parser",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
|
-
"url": "git://github.com/crisp-
|
|
10
|
+
"url": "git://github.com/crisp-oss/email-forward-parser"
|
|
10
11
|
},
|
|
11
12
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/crisp-
|
|
13
|
+
"url": "https://github.com/crisp-oss/email-forward-parser/issues"
|
|
13
14
|
},
|
|
14
15
|
"scripts": {
|
|
15
16
|
"test": "nodeunit ./test/index.js"
|