email-forward-parser 1.0.5 → 1.0.9

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.
@@ -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
- # email-forward-parser
1
+ # Email Forward Parser
2
2
 
3
- [![NPM](https://img.shields.io/npm/v/email-forward-parser.svg)](https://www.npmjs.com/package/email-forward-parser) [![Downloads](https://img.shields.io/npm/dt/email-forward-parser.svg)](https://www.npmjs.com/package/email-forward-parser)
3
+ [![Test and Build](https://github.com/crisp-oss/email-forward-parser/workflows/Test%20and%20Build/badge.svg?branch=master)](https://github.com/crisp-oss/email-forward-parser/actions?query=workflow%3A%22Test+and+Build%22) [![NPM](https://img.shields.io/npm/v/email-forward-parser.svg)](https://www.npmjs.com/package/email-forward-parser) [![Downloads](https://img.shields.io/npm/dt/email-forward-parser.svg)](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/index.js CHANGED
@@ -55,8 +55,8 @@ class EmailForwardParser {
55
55
  body : _email.body,
56
56
 
57
57
  from : {
58
- email : (_email.from || {}).email,
59
- name : (_email.from || {}).name
58
+ address : (_email.from || {}).address,
59
+ name : (_email.from || {}).name
60
60
  },
61
61
 
62
62
  to : _email.to,
package/lib/parser.js CHANGED
@@ -44,6 +44,7 @@ var REGEXES = {
44
44
  /^>?\s*Inicio del mensaje reenviado\s?:/m, // Apple Mail (es)
45
45
  /^>?\s*Välitetty viesti alkaa\s?:/m, // Apple Mail (fi)
46
46
  /^>?\s*Début du message réexpédié\s?:/m, // Apple Mail (fr)
47
+ /^>?\s*Début du message transféré\s?:/m, // Apple Mail iOS (fr)
47
48
  /^>?\s*Započni proslijeđenu poruku\s?:/m, // Apple Mail (hr)
48
49
  /^>?\s*Továbbított levél kezdete\s?:/m, // Apple Mail (hu)
49
50
  /^>?\s*Inizio messaggio inoltrato\s?:/m, // Apple Mail (it)
@@ -60,23 +61,23 @@ var REGEXES = {
60
61
  /^>?\s*Початок листа, що пересилається\s?:/m, // Apple Mail (uk)
61
62
  /^\s*-{1,20}\s*Forwarded message\s*-{1,20}\s*/m, // Gmail (all locales)
62
63
  /^\s*_{20,40}\s*$/m, // Outlook Live (all locales)
63
- /^\s?Dne\s?(?<date>.+)\,\s?(?<from_name>.+)\s*[\[|<](?<from_email>.+)[\]|>]\s?napsal\(a\)\s?:/m, // Outlook 2019 (cz)
64
- /^\s?D.\s?(?<date>.+)\s?skrev\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\s?:/m, // Outlook 2019 (da)
65
- /^\s?Am\s?(?<date>.+)\s?schrieb\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\s?:/m, // Outlook 2019 (de)
66
- /^\s?On\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\s?wrote\s?:/m, // Outlook 2019 (en)
67
- /^\s?El\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\s?escribió\s?:/m, // Outlook 2019 (es)
68
- /^\s?Le\s?(?<date>.+)\,\s?«(?<from_name>.+)»\s*[\[|<](?<from_email>.+)[\]|>]\s?a écrit\s?:/m, // Outlook 2019 (fr)
69
- /^\s?(?<from_name>.+)\s*[\[|<](?<from_email>.+)[\]|>]\s?kirjoitti\s?(?<date>.+)\s?:/m, // Outlook 2019 (fi)
70
- /^\s?(?<date>.+)\s?időpontban\s?(?<from_name>.+)\s*[\[|<|(](?<from_email>.+)[\]|>|)]\s?ezt írta\s?:/m, // Outlook 2019 (hu)
71
- /^\s?Il giorno\s?(?<date>.+)\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\s?ha scritto\s?:/m, // Outlook 2019 (it)
72
- /^\s?Op\s?(?<date>.+)\s?heeft\s?(?<from_name>.+)\s*[\[|<](?<from_email>.+)[\]|>]\s?geschreven\s?:/m, // Outlook 2019 (nl)
73
- /^\s?(?<from_name>.+)\s*[\[|<](?<from_email>.+)[\]|>]\s?skrev følgende den\s?(?<date>.+)\s?:/m, // Outlook 2019 (no)
74
- /^\s?Dnia\s?(?<date>.+)\s?„(?<from_name>.+)”\s*[\[|<](?<from_email>.+)[\]|>]\s?napisał\s?:/m, // Outlook 2019 (pl)
75
- /^\s?Em\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\s?escreveu\s?:/m, // Outlook 2019 (pt)
76
- /^\s?(?<date>.+)\s?пользователь\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\s?написал\s?:/m, // Outlook 2019 (ru)
77
- /^\s?(?<date>.+)\s?používateľ\s?(?<from_name>.+)\s*\([\[|<](?<from_email>.+)[\]|>]\)\s?napísal\s?:/m, // Outlook 2019 (sk)
78
- /^\s?Den\s?(?<date>.+)\s?skrev\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\s?följande\s?:/m, // Outlook 2019 (sv)
79
- /^\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_email>.+)[\]|>]\,\s?(?<date>.+)\s?tarihinde şunu yazdı\s?:/m, // Outlook 2019 (tr)
64
+ /^\s?Dne\s?(?<date>.+)\,\s?(?<from_name>.+)\s*[\[|<](?<from_address>.+)[\]|>]\s?napsal\(a\)\s?:/m, // Outlook 2019 (cz)
65
+ /^\s?D.\s?(?<date>.+)\s?skrev\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?:/m, // Outlook 2019 (da)
66
+ /^\s?Am\s?(?<date>.+)\s?schrieb\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?:/m, // Outlook 2019 (de)
67
+ /^\s?On\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?wrote\s?:/m, // Outlook 2019 (en)
68
+ /^\s?El\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?escribió\s?:/m, // Outlook 2019 (es)
69
+ /^\s?Le\s?(?<date>.+)\,\s?«(?<from_name>.+)»\s*[\[|<](?<from_address>.+)[\]|>]\s?a écrit\s?:/m, // Outlook 2019 (fr)
70
+ /^\s?(?<from_name>.+)\s*[\[|<](?<from_address>.+)[\]|>]\s?kirjoitti\s?(?<date>.+)\s?:/m, // Outlook 2019 (fi)
71
+ /^\s?(?<date>.+)\s?időpontban\s?(?<from_name>.+)\s*[\[|<|(](?<from_address>.+)[\]|>|)]\s?ezt írta\s?:/m, // Outlook 2019 (hu)
72
+ /^\s?Il giorno\s?(?<date>.+)\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?ha scritto\s?:/m, // Outlook 2019 (it)
73
+ /^\s?Op\s?(?<date>.+)\s?heeft\s?(?<from_name>.+)\s*[\[|<](?<from_address>.+)[\]|>]\s?geschreven\s?:/m, // Outlook 2019 (nl)
74
+ /^\s?(?<from_name>.+)\s*[\[|<](?<from_address>.+)[\]|>]\s?skrev følgende den\s?(?<date>.+)\s?:/m, // Outlook 2019 (no)
75
+ /^\s?Dnia\s?(?<date>.+)\s?„(?<from_name>.+)”\s*[\[|<](?<from_address>.+)[\]|>]\s?napisał\s?:/m, // Outlook 2019 (pl)
76
+ /^\s?Em\s?(?<date>.+)\,\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?escreveu\s?:/m, // Outlook 2019 (pt)
77
+ /^\s?(?<date>.+)\s?пользователь\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?написал\s?:/m, // Outlook 2019 (ru)
78
+ /^\s?(?<date>.+)\s?používateľ\s?(?<from_name>.+)\s*\([\[|<](?<from_address>.+)[\]|>]\)\s?napísal\s?:/m, // Outlook 2019 (sk)
79
+ /^\s?Den\s?(?<date>.+)\s?skrev\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\s?följande\s?:/m, // Outlook 2019 (sv)
80
+ /^\s?\"(?<from_name>.+)\"\s*[\[|<](?<from_address>.+)[\]|>]\,\s?(?<date>.+)\s?tarihinde şunu yazdı\s?:/m, // Outlook 2019 (tr)
80
81
  /\s*-{5,8} Přeposlaná zpráva -{5,8}\s*/m, // Yahoo Mail (cs), Thunderbird (cs)
81
82
  /\s*-{5,8} Videresendt meddelelse -{5,8}\s*/m, // Yahoo Mail (da), Thunderbird (da)
82
83
  /\s*-{5,8} Weitergeleitete Nachricht -{5,8}\s*/m, // Yahoo Mail (de), Thunderbird (de)
@@ -324,7 +325,7 @@ var REGEXES = {
324
325
  /\s*Відправлено\s?:(.+)$/m // Yahoo Mail (uk)
325
326
  ],
326
327
 
327
- name_email : [
328
+ name_address : [
328
329
  /^\"(.+)\"\s?\n?\s*[\[|<](.+)[\]|>]$/, // ""Walter Sheltan" <walter.sheltan@acme.com>" or ""walter.sheltan@acme.com" <walter.sheltan@acme.com>"
329
330
  /^(.+)\s?\n?\s*[\[|<](.+)[\]|>]$/, // "Walter Sheltan <walter.sheltan@acme.com>" or "walter.sheltan@acme.com <walter.sheltan@acme.com>"
330
331
  /^(.?)\s?\n?\s*[\[|<](.+)[\]|>]$/, // "<walter.sheltan@acme.com>"
@@ -393,9 +394,9 @@ class Parser {
393
394
 
394
395
  // Attempt second method?
395
396
  // Notice: as this second method is more uncertain (we split via the From \
396
- // From 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)
397
+ // part, without further verification), we have to be sure we can \
398
+ // attempt it. The `forwarded` boolean gives the confirmation that the \
399
+ // email was indeed forwarded (detected from the Subject part)
399
400
  if (forwarded === true) {
400
401
  // Second method: split via the Form part (New Outlook 2019)
401
402
  _match = loopRegexes(this.__regexes.original_from, _body, "split");
@@ -481,7 +482,7 @@ class Parser {
481
482
  __parseOriginalBody(text) {
482
483
  var _match = null;
483
484
 
484
- // First method: extract the text after the Cc, To or Reply-To part
485
+ // First method: extract the text after the Cc, To or Reply-To part \
485
486
  // (Apple Mail, Gmail) or after the Subject part (Outlook Live)
486
487
  var _regexes = [
487
488
  this.__regexes.original_subject,
@@ -500,7 +501,7 @@ class Parser {
500
501
  }
501
502
  }
502
503
 
503
- // Second method: extract the text after the Subject part
504
+ // Second method: extract the text after the Subject part \
504
505
  // (New Outlook 2019, Yahoo Mail)
505
506
  _match = loopRegexes(
506
507
  this.__regexes.original_subject.concat(
@@ -530,7 +531,7 @@ class Parser {
530
531
  * @return {object} The parsed author
531
532
  */
532
533
  __parseOriginalFrom(text, body) {
533
- var _email = null;
534
+ var _address = null;
534
535
  var _name = null;
535
536
 
536
537
  // First method: extract the author via the From part (Apple Mail, Gmail, \
@@ -538,7 +539,7 @@ class Parser {
538
539
  var _author = this.__parseMailbox(this.__regexes.original_from, text);
539
540
 
540
541
  // Author found?
541
- if (_author.email) {
542
+ if (_author.address) {
542
543
  return _author;
543
544
  }
544
545
 
@@ -548,15 +549,15 @@ class Parser {
548
549
  if (_match && _match.length === 4 && _match.groups) {
549
550
  // Notice: the order of parts may change depending on the localization, \
550
551
  // hence the use of named groups
551
- _email = trimString(_match.groups.from_email);
552
+ _address = trimString(_match.groups.from_address);
552
553
  _name = trimString(_match.groups.from_name);
553
554
 
554
555
  return {
555
- email : _email,
556
+ address : _address,
556
557
 
557
- // Some clients fill the name with the email \
558
+ // Some clients fill the name with the address \
558
559
  // ("bessie.berry@acme.com <bessie.berry@acme.com>")
559
- name : (_email !== _name) ? _name : null
560
+ name : (_address !== _name) ? _name : null
560
561
  };
561
562
  }
562
563
 
@@ -565,21 +566,21 @@ class Parser {
565
566
  _match = loopRegexes(this.__regexes.original_from_lax, text);
566
567
 
567
568
  if (_match && _match.length > 1) {
568
- _email = trimString(_match[3]);
569
+ _address = trimString(_match[3]);
569
570
  _name = trimString(_match[2]);
570
571
 
571
572
  return {
572
- email : _email,
573
+ address : _address,
573
574
 
574
- // Some clients fill the name with the email \
575
+ // Some clients fill the name with the address \
575
576
  // ("bessie.berry@acme.com <bessie.berry@acme.com>")
576
- name : (_email !== _name) ? _name : null
577
+ name : (_address !== _name) ? _name : null
577
578
  };
578
579
  }
579
580
 
580
581
  return {
581
- email : _email,
582
- name : _name
582
+ address : _address,
583
+ name : _name
583
584
  };
584
585
  }
585
586
 
@@ -593,11 +594,16 @@ class Parser {
593
594
  __parseOriginalTo(text) {
594
595
  // First method: extract the primary recipient(s) via the To part \
595
596
  // (Apple Mail, Gmail, Outlook Live, New Outlook 2019, Thunderbird)
596
- var _recipients = this.__parseMailbox(this.__regexes.original_to, text);
597
+ var _recipients = this.__parseMailbox(
598
+ this.__regexes.original_to,
599
+
600
+ text,
601
+ true //- [force_array]
602
+ );
597
603
 
598
604
  // Recipient(s) found?
599
- if (Array.isArray(_recipients) ||
600
- !(_recipients.email === null && _recipients.name === null)
605
+ if (Array.isArray(_recipients) &&
606
+ !(_recipients[0].address === null && _recipients[0].name === null)
601
607
  ) {
602
608
  return _recipients;
603
609
  }
@@ -626,8 +632,12 @@ class Parser {
626
632
  "replace"
627
633
  );
628
634
 
635
+ return this.__parseMailbox(
636
+ this.__regexes.original_to_lax,
629
637
 
630
- return this.__parseMailbox(this.__regexes.original_to_lax, _cleanText);
638
+ _cleanText,
639
+ true //- [force_array]
640
+ );
631
641
  }
632
642
 
633
643
 
@@ -638,13 +648,18 @@ class Parser {
638
648
  * @return {object} The parsed carbon-copy recipient(s)
639
649
  */
640
650
  __parseOriginalCc(text) {
641
- // First method: extract the carbon-copy recipient(s) via the Cc part
651
+ // First method: extract the carbon-copy recipient(s) via the Cc part \
642
652
  // (Apple Mail, Gmail, Outlook Live, New Outlook 2019, Thunderbird)
643
- var _recipients = this.__parseMailbox(this.__regexes.original_cc, text);
653
+ var _recipients = this.__parseMailbox(
654
+ this.__regexes.original_cc,
655
+
656
+ text,
657
+ true //- [force_array]
658
+ );
644
659
 
645
660
  // Recipient(s) found?
646
- if (Array.isArray(_recipients) ||
647
- !(_recipients.email === null && _recipients.name === null)
661
+ if (Array.isArray(_recipients) &&
662
+ !(_recipients[0].address === null && _recipients[0].name === null)
648
663
  ) {
649
664
  return _recipients;
650
665
  }
@@ -666,17 +681,24 @@ class Parser {
666
681
  "replace"
667
682
  );
668
683
 
669
- return this.__parseMailbox(this.__regexes.original_cc_lax, _cleanText);
684
+ return this.__parseMailbox(
685
+ this.__regexes.original_cc_lax,
686
+
687
+ _cleanText,
688
+ true //- [force_array]
689
+ );
670
690
  }
671
691
 
672
692
 
673
693
  /**
674
694
  * Parses mailboxes(s)
675
695
  * @private
676
- * @param {string} text
677
- * @return {object} The parsed mailboxes(s)
696
+ * @param {object} regexes
697
+ * @param {string} text
698
+ * @param {boolean} [force_array]
699
+ * @return {object} The parsed mailboxes(s)
678
700
  */
679
- __parseMailbox(regexes, text) {
701
+ __parseMailbox(regexes, text, force_array=false) {
680
702
  var _match = loopRegexes(regexes, text);
681
703
 
682
704
  if (_match && _match.length > 0) {
@@ -690,29 +712,29 @@ class Parser {
690
712
  "split"
691
713
  );
692
714
 
693
- // Extract name and email (single / multiple mailboxes)
715
+ // Extract name and address (single / multiple mailboxes)
694
716
  for (var _i = 0; _i < _mailboxes.length; _i++) {
695
- var _nameEmailMatch = loopRegexes(
696
- this.__regexes.name_email,
717
+ var _nameAddressMatch = loopRegexes(
718
+ this.__regexes.name_address,
697
719
  trimString(_mailboxes[_i])
698
720
  );
699
721
 
700
- // Name and email available?
701
- if (_nameEmailMatch && _nameEmailMatch.length > 0) {
702
- var _email = trimString(_nameEmailMatch[2]);
703
- var _name = trimString(_nameEmailMatch[1]);
722
+ // Name and address available?
723
+ if (_nameAddressMatch && _nameAddressMatch.length > 0) {
724
+ var _address = trimString(_nameAddressMatch[2]);
725
+ var _name = trimString(_nameAddressMatch[1]);
704
726
 
705
727
  _mailboxes[_i] = {
706
- email : _email,
728
+ address : _address,
707
729
 
708
- // Some clients fill the name with the email \
730
+ // Some clients fill the name with the address \
709
731
  // ("bessie.berry@acme.com <bessie.berry@acme.com>")
710
- name : (_email !== _name) ? _name : null
732
+ name : (_address !== _name) ? _name : null
711
733
  };
712
734
  } else {
713
735
  _mailboxes[_i] = {
714
- email : trimString(_mailboxes[_i]),
715
- name : null
736
+ address : trimString(_mailboxes[_i]),
737
+ name : null
716
738
  };
717
739
  }
718
740
  }
@@ -723,14 +745,16 @@ class Parser {
723
745
  }
724
746
 
725
747
  // Return single mailbox
726
- return _mailboxes[0];
748
+ return (force_array === true) ? _mailboxes : _mailboxes[0];
727
749
  }
728
750
  }
729
751
 
730
- return {
731
- email : null,
732
- name : null
752
+ var _mailbox = {
753
+ address : null,
754
+ name : null
733
755
  };
756
+
757
+ return (force_array === true) ? [_mailbox] : _mailbox;
734
758
  }
735
759
 
736
760
 
@@ -741,7 +765,7 @@ class Parser {
741
765
  * @return {string} The parsed subject
742
766
  */
743
767
  __parseOriginalSubject(text) {
744
- // First method: extract the subject via the Subject part (Apple Mail,
768
+ // First method: extract the subject via the Subject part (Apple Mail, \
745
769
  // Gmail, Outlook Live, New Outlook 2019, Thunderbird)
746
770
  var _match = loopRegexes(this.__regexes.original_subject, text);
747
771
 
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "email-forward-parser",
3
- "version": "1.0.5",
3
+ "version": "1.0.9",
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-dev/email-forward-parser"
10
+ "url": "git://github.com/crisp-oss/email-forward-parser"
10
11
  },
11
12
  "bugs": {
12
- "url": "https://github.com/crisp-dev/email-forward-parser/issues"
13
+ "url": "https://github.com/crisp-oss/email-forward-parser/issues"
13
14
  },
14
15
  "scripts": {
15
16
  "test": "nodeunit ./test/index.js"
package/test.js ADDED
@@ -0,0 +1,7 @@
1
+ const EmailForwardParser = require("./");
2
+ const fs = require("fs");
3
+
4
+ MY_EMAIL_STRING = fs.readFileSync("./test.txt", "utf-8");
5
+ const result = new EmailForwardParser().read(MY_EMAIL_STRING);
6
+
7
+ console.log(result.forwarded);
package/test.txt ADDED
@@ -0,0 +1,21 @@
1
+
2
+
3
+ Envoyé de mon iPhone
4
+
5
+ Début du message transféré :
6
+
7
+ > From: Dotan Brown <dotan@prizepicks.com>
8
+ > Date: 12 January 2022 at 14:22:12 CET
9
+ > To: Eliott <eliott@crisp.chat>
10
+ > Subject: Daily image quota
11
+ >
12
+ > 
13
+ > Good morning,
14
+ >
15
+ >
16
+ > Could we please get a reset on our daily image quota for the day?
17
+ >
18
+ >
19
+ > Thanks in advance,
20
+ >
21
+ > Dotan-PrizePicks