email-forward-parser 1.5.7 → 1.5.10

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/utils.js +3 -5
  2. package/package.json +2 -2
package/lib/utils.js CHANGED
@@ -23,6 +23,8 @@ var loopRegexes = function(
23
23
  regexes, str, mode = "match", highestPosition = true
24
24
  ) {
25
25
  var _match;
26
+ var _minLength = mode === "split" ? 1 : 0;
27
+ var _maxLength = str.length;
26
28
 
27
29
  for (var _i = 0; _i < regexes.length; _i++) {
28
30
  var _regex = regexes[_i];
@@ -40,15 +42,11 @@ var loopRegexes = function(
40
42
  _match = _currentMatch;
41
43
 
42
44
  // A successfull replace must return a smaller string than the input
43
- var _maxLength = str.length;
44
-
45
45
  if (_match.length < _maxLength) {
46
46
  break;
47
47
  }
48
48
  } else if (mode === "split" || mode === "match") {
49
49
  // A successfull split must return an array with at least two items
50
- var _minLength = mode === "split" ? 1 : 0;
51
-
52
50
  if ((_currentMatch || []).length > _minLength) {
53
51
  if (highestPosition === true) {
54
52
  // No previous match?
@@ -80,7 +78,7 @@ var loopRegexes = function(
80
78
  }
81
79
  }
82
80
 
83
- return (_match || []);
81
+ return (mode === "replace") ? (_match || "") : (_match || []);
84
82
  }
85
83
 
86
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-forward-parser",
3
- "version": "1.5.7",
3
+ "version": "1.5.10",
4
4
  "description": "Parses forwarded emails and extract content",
5
5
  "author": "Eliott Vincent <eliott@crisp.chat>",
6
6
  "main": "lib/index.js",
@@ -23,7 +23,7 @@
23
23
  "nodeunit-x": "0.15.0"
24
24
  },
25
25
  "dependencies": {
26
- "re2": "1.20.1"
26
+ "re2": "1.20.9"
27
27
  },
28
28
  "keywords": [
29
29
  "parser",