mailparser 3.3.2 → 3.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/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ *.js text eol=lf
@@ -0,0 +1,21 @@
1
+ name: Run tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ strategy:
10
+ matrix:
11
+ node: [12.x, 14.x, 16.x, 18.x]
12
+ os: [ubuntu-latest, macos-latest]
13
+ runs-on: ${{ matrix.os }}
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Use Node.js ${{ matrix.node }}
17
+ uses: actions/setup-node@v1
18
+ with:
19
+ node-version: ${{ matrix.node }}
20
+ - run: npm install
21
+ - run: npm test
@@ -14,7 +14,6 @@ const he = require('he');
14
14
  const linkify = require('linkify-it')();
15
15
  const tlds = require('tlds');
16
16
  const encodingJapanese = require('encoding-japanese');
17
- const anyDateParser = require('any-date-parser');
18
17
 
19
18
  linkify
20
19
  .tlds(tlds) // Reload with full tlds list
@@ -139,7 +138,7 @@ class MailParser extends Transform {
139
138
 
140
139
  this.endReceived = false;
141
140
  this.reading = false;
142
- this.errored = false;
141
+ this.hasFailed = false;
143
142
 
144
143
  this.tree = false;
145
144
  this.curnode = false;
@@ -176,7 +175,7 @@ class MailParser extends Transform {
176
175
  });
177
176
 
178
177
  this.splitter.on('error', err => {
179
- this.errored = true;
178
+ this.hasFailed = true;
180
179
  if (typeof this.waitingEnd === 'function') {
181
180
  return this.waitingEnd(err);
182
181
  }
@@ -211,7 +210,7 @@ class MailParser extends Transform {
211
210
  }
212
211
 
213
212
  readData() {
214
- if (this.errored) {
213
+ if (this.hasFailed) {
215
214
  return false;
216
215
  }
217
216
  this.reading = true;
@@ -313,13 +312,15 @@ class MailParser extends Transform {
313
312
  }
314
313
  });
315
314
  break;
316
- case 'date':
317
- value = anyDateParser.fromString(value);
318
- if (isNaN(value)) {
315
+ case 'date': {
316
+ let dateValue = new Date(value);
317
+ if (isNaN(dateValue)) {
319
318
  // date parsing failed :S
320
- value = new Date();
319
+ dateValue = new Date();
321
320
  }
321
+ value = dateValue;
322
322
  break;
323
+ }
323
324
  case 'subject':
324
325
  try {
325
326
  value = this.libmime.decodeWords(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailparser",
3
- "version": "3.3.2",
3
+ "version": "3.5.0",
4
4
  "description": "Parse e-mails",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,26 +16,25 @@
16
16
  ],
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "any-date-parser": "1.5.1",
20
- "encoding-japanese": "1.0.30",
19
+ "encoding-japanese": "2.0.0",
21
20
  "he": "1.2.0",
22
- "html-to-text": "8.0.0",
21
+ "html-to-text": "8.2.0",
23
22
  "iconv-lite": "0.6.3",
24
- "libmime": "5.0.0",
25
- "linkify-it": "3.0.2",
26
- "mailsplit": "5.2.0",
27
- "nodemailer": "6.6.5",
28
- "tlds": "1.222.0"
23
+ "libmime": "5.1.0",
24
+ "linkify-it": "4.0.0",
25
+ "mailsplit": "5.3.2",
26
+ "nodemailer": "6.7.3",
27
+ "tlds": "1.231.0"
29
28
  },
30
29
  "devDependencies": {
31
- "ajv": "8.6.3",
32
- "eslint": "7.32.0",
30
+ "ajv": "8.11.0",
31
+ "eslint": "8.14.0",
33
32
  "eslint-config-nodemailer": "1.2.0",
34
- "eslint-config-prettier": "8.3.0",
35
- "grunt": "1.4.1",
33
+ "eslint-config-prettier": "8.5.0",
34
+ "grunt": "1.5.2",
36
35
  "grunt-cli": "1.4.3",
37
- "grunt-contrib-nodeunit": "3.0.0",
38
- "grunt-eslint": "23.0.0",
36
+ "grunt-contrib-nodeunit": "4.0.0",
37
+ "grunt-eslint": "24.0.0",
39
38
  "iconv": "3.0.1",
40
39
  "random-message": "1.1.0"
41
40
  },