email-forward-parser 1.4.1 → 1.5.0
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/lib/parser.js +12 -6
- package/package.json +2 -2
package/lib/parser.js
CHANGED
|
@@ -574,28 +574,30 @@ class Parser {
|
|
|
574
574
|
this.__regexes[_key_line] = [];
|
|
575
575
|
|
|
576
576
|
for (var _i = 0; _i < _entry.length; _i++) {
|
|
577
|
-
var
|
|
577
|
+
var _regex = _entry[_i];
|
|
578
578
|
|
|
579
579
|
// Build 'line' alternative?
|
|
580
580
|
if (LINE_REGEXES.includes(_key)) {
|
|
581
|
-
var _regex_line = this.__buildLineRegex(
|
|
581
|
+
var _regex_line = this.__buildLineRegex(_regex);
|
|
582
582
|
|
|
583
583
|
this.__regexes[_key_line].push(_regex_line);
|
|
584
584
|
}
|
|
585
585
|
|
|
586
|
-
this.__regexes[_key].push(
|
|
586
|
+
this.__regexes[_key].push(
|
|
587
|
+
new RE2(_regex)
|
|
588
|
+
);
|
|
587
589
|
}
|
|
588
590
|
} else {
|
|
589
|
-
var
|
|
591
|
+
var _regex = _entry;
|
|
590
592
|
|
|
591
593
|
// Build 'line' alternative?
|
|
592
594
|
if (LINE_REGEXES.includes(_key)) {
|
|
593
|
-
var _regex_line = this.__buildLineRegex(
|
|
595
|
+
var _regex_line = this.__buildLineRegex(_regex);
|
|
594
596
|
|
|
595
597
|
this.__regexes[_key_line] = _regex_line;
|
|
596
598
|
}
|
|
597
599
|
|
|
598
|
-
this.__regexes[_key] =
|
|
600
|
+
this.__regexes[_key] = new RE2(_regex);
|
|
599
601
|
}
|
|
600
602
|
}
|
|
601
603
|
}
|
|
@@ -610,6 +612,10 @@ class Parser {
|
|
|
610
612
|
__buildLineRegex(regex) {
|
|
611
613
|
// A 'line' regex will capture not only inner groups, but also the line \
|
|
612
614
|
// itself
|
|
615
|
+
// Important: `regex` must be a raw regular expression literal, not an RE2 \
|
|
616
|
+
// instance. It seems that under some inexplicable circumstances, \
|
|
617
|
+
// the RE2 instance sometimes doesn't have its `source` and `flags` \
|
|
618
|
+
// properties correctly populated.
|
|
613
619
|
var _source = `(${regex.source})`;
|
|
614
620
|
var _flags = regex.flags;
|
|
615
621
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "email-forward-parser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Parses forwarded emails and extract content",
|
|
5
5
|
"author": "Eliott Vincent <eliott@crisp.chat>",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"nodeunit-x": "0.15.0"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"re2": "1.
|
|
22
|
+
"re2": "1.20.1"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
25
25
|
"parser",
|