email-forward-parser 1.0.21 → 1.0.22

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.
Files changed (2) hide show
  1. package/lib/parser.js +5 -13
  2. package/package.json +1 -1
package/lib/parser.js CHANGED
@@ -568,7 +568,7 @@ class Parser {
568
568
  var _author = this.__parseMailbox(this.__regexes.original_from, text);
569
569
 
570
570
  // Author found?
571
- if (_author.address) {
571
+ if ((_author || {}).address) {
572
572
  return _author;
573
573
  }
574
574
 
@@ -636,9 +636,7 @@ class Parser {
636
636
  );
637
637
 
638
638
  // Recipient(s) found?
639
- if (Array.isArray(_recipients) &&
640
- !(_recipients[0].address === null && _recipients[0].name === null)
641
- ) {
639
+ if (Array.isArray(_recipients) && _recipients.length > 0) {
642
640
  return _recipients;
643
641
  }
644
642
 
@@ -692,9 +690,7 @@ class Parser {
692
690
  );
693
691
 
694
692
  // Recipient(s) found?
695
- if (Array.isArray(_recipients) &&
696
- !(_recipients[0].address === null && _recipients[0].name === null)
697
- ) {
693
+ if (Array.isArray(_recipients) && _recipients.length > 0) {
698
694
  return _recipients;
699
695
  }
700
696
 
@@ -807,12 +803,8 @@ class Parser {
807
803
  }
808
804
  }
809
805
 
810
- var _mailbox = {
811
- address : null,
812
- name : null
813
- };
814
-
815
- return (force_array === true) ? [_mailbox] : _mailbox;
806
+ // No mailbox found
807
+ return (force_array === true) ? [] : null;
816
808
  }
817
809
 
818
810
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-forward-parser",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Parses forwarded emails and extract content",
5
5
  "author": "Eliott Vincent <eliott@crisp.chat>",
6
6
  "main": "lib/index.js",