New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mailparser

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailparser - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

36

lib/mail-parser.js

@@ -12,3 +12,2 @@ 'use strict';

const iconv = require('iconv-lite');
const marked = require('marked');
const htmlToText = require('html-to-text');

@@ -506,9 +505,3 @@ const he = require('he');

if (!alternative && this.hasHtml) {
html.push(marked(node.textContent, {
breaks: true,
sanitize: true,
gfm: true,
tables: true,
smartypants: true
}));
html.push(textToHtml(node.textContent));
}

@@ -538,9 +531,3 @@ } else if (node.contentType === 'text/html') {

this.text = response.text = text.join('\n');
this.textAsHtml = response.textAsHtml = text.map(part => marked(part, {
breaks: true,
sanitize: true,
gfm: true,
tables: true,
smartypants: true
})).join('<br/>\n');
this.textAsHtml = response.textAsHtml = text.map(part => textToHtml(part)).join('<br/>\n');
}

@@ -622,3 +609,3 @@ return response;

} else if(node.disposition === 'inline') {
} else if (node.disposition === 'inline') {
let chunks = [];

@@ -798,1 +785,18 @@ let chunklen = 0;

module.exports = MailParser;
function textToHtml(str) {
let text = '<p>' + he.
// encode special chars
encode(
str, {
useNamedReferences: true
}).
replace(/\r?\n/g, '\n').trim(). // normalize line endings
replace(/[ \t]+$/mg, '').trim(). // trim empty line endings
replace(/\n\n+/g, '</p><p>').trim(). // insert <p> to multiple linebreaks
replace(/\n/g, '<br/>') + // insert <br> to single linebreaks
'</p>';
return text;
}
{
"name": "mailparser",
"version": "2.0.4",
"version": "2.0.5",
"description": "Parse e-mails",

@@ -13,8 +13,7 @@ "main": "index.js",

"addressparser": "1.0.1",
"he": "1.1.1",
"he": "^1.1.1",
"html-to-text": "3.2.0",
"iconv-lite": "0.4.15",
"iconv-lite": "0.4.17",
"libmime": "3.1.0",
"mailsplit": "4.0.2",
"marked": "0.3.6"
"mailsplit": "4.0.2"
},

@@ -21,0 +20,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc