libmime
Advanced tools
Comparing version 4.2.1 to 5.0.0
module.exports = { | ||
printWidth: 160, | ||
tabWidth: 4, | ||
singleQuote: true | ||
singleQuote: true, | ||
endOfLine: 'lf', | ||
trailingComma: 'none', | ||
arrowParens: 'avoid' | ||
}; |
# Changelog | ||
## v5.0.0 2020-07-22 | ||
- Removed optional node-iconv support | ||
- Bumped dependencies | ||
- Updated Travis test matrix, dropped Node 8 | ||
## v4.2.1 2019-10-28 | ||
@@ -4,0 +10,0 @@ |
@@ -29,6 +29,5 @@ 'use strict'; | ||
* @param {String} [fromCharset='UTF-8'] Binary data is decoded into string using this charset | ||
* @param {Function} [Iconv] node-iconv function | ||
* @return {String} Decded string | ||
*/ | ||
decode(buf, fromCharset, Iconv) { | ||
decode(buf, fromCharset) { | ||
fromCharset = charset.normalizeCharset(fromCharset || 'UTF-8'); | ||
@@ -41,7 +40,2 @@ | ||
try { | ||
if (typeof Iconv === 'function') { | ||
let decoder = new Iconv(fromCharset, 'UTF-8'); | ||
return decoder.convert(buf).toString(); | ||
} | ||
if (/^jis|^iso-?2022-?jp|^EUCJP/i.test(fromCharset)) { | ||
@@ -80,3 +74,3 @@ if (typeof buf === 'string') { | ||
*/ | ||
convert(data, fromCharset, Iconv) { | ||
convert(data, fromCharset) { | ||
fromCharset = charset.normalizeCharset(fromCharset || 'UTF-8'); | ||
@@ -91,3 +85,3 @@ | ||
bufString = charset.decode(data, fromCharset, Iconv); | ||
bufString = charset.decode(data, fromCharset); | ||
return charset.encode(bufString); | ||
@@ -94,0 +88,0 @@ } |
@@ -115,7 +115,3 @@ /* eslint no-control-regex: 0, no-div-regex: 0, quotes: 0 */ | ||
encodeWord(data, mimeWordEncoding, maxLength) { | ||
mimeWordEncoding = (mimeWordEncoding || 'Q') | ||
.toString() | ||
.toUpperCase() | ||
.trim() | ||
.charAt(0); | ||
mimeWordEncoding = (mimeWordEncoding || 'Q').toString().toUpperCase().trim().charAt(0); | ||
maxLength = maxLength || 0; | ||
@@ -133,6 +129,3 @@ | ||
encodedStr = libqp.encode(data).replace(/[^a-z0-9!*+\-/=]/gi, chr => { | ||
let ord = chr | ||
.charCodeAt(0) | ||
.toString(16) | ||
.toUpperCase(); | ||
let ord = chr.charCodeAt(0).toString(16).toUpperCase(); | ||
if (chr === ' ') { | ||
@@ -239,3 +232,3 @@ return '_'; | ||
return libcharset.decode(str, charset, this.config.Iconv); | ||
return libcharset.decode(str, charset); | ||
} | ||
@@ -260,3 +253,3 @@ | ||
let decodedValue = libcharset.decode(libcharset.convert(data || '', fromCharset, this.config.Iconv), this.config.Iconv); | ||
let decodedValue = libcharset.decode(libcharset.convert(data || '', fromCharset)); | ||
let encodedValue; | ||
@@ -730,6 +723,3 @@ | ||
detectExtension(mimeType) { | ||
mimeType = (mimeType || '') | ||
.toString() | ||
.toLowerCase() | ||
.replace(/\s/g, ''); | ||
mimeType = (mimeType || '').toString().toLowerCase().replace(/\s/g, ''); | ||
if (!(mimeType in mimetypes.list)) { | ||
@@ -764,9 +754,3 @@ return 'bin'; | ||
detectMimeType(extension) { | ||
extension = (extension || '') | ||
.toString() | ||
.toLowerCase() | ||
.replace(/\s/g, '') | ||
.replace(/^\./g, '') | ||
.split('.') | ||
.pop(); | ||
extension = (extension || '').toString().toLowerCase().replace(/\s/g, '').replace(/^\./g, '').split('.').pop(); | ||
@@ -891,6 +875,3 @@ if (!(extension in mimetypes.extensions)) { | ||
let res = ''; | ||
let ord = chr | ||
.charCodeAt(0) | ||
.toString(16) | ||
.toUpperCase(); | ||
let ord = chr.charCodeAt(0).toString(16).toUpperCase(); | ||
@@ -897,0 +878,0 @@ if (ord.length % 2) { |
{ | ||
"name": "libmime", | ||
"description": "Encode and decode quoted printable and base64 strings", | ||
"version": "4.2.1", | ||
"version": "5.0.0", | ||
"main": "lib/libmime", | ||
@@ -23,3 +23,3 @@ "homepage": "https://github.com/andris9/libmime", | ||
"encoding-japanese": "1.0.30", | ||
"iconv-lite": "0.5.0", | ||
"iconv-lite": "0.6.2", | ||
"libbase64": "1.2.1", | ||
@@ -31,10 +31,9 @@ "libqp": "1.1.0" | ||
"eslint-config-nodemailer": "1.2.0", | ||
"eslint-config-prettier": "6.5.0", | ||
"grunt": "1.0.4", | ||
"eslint-config-prettier": "6.11.0", | ||
"grunt": "1.2.1", | ||
"grunt-cli": "1.3.2", | ||
"grunt-eslint": "22.0.0", | ||
"grunt-eslint": "23.0.0", | ||
"grunt-mocha-test": "0.13.3", | ||
"iconv": "2.3.5", | ||
"mocha": "6.2.2" | ||
"mocha": "8.0.1" | ||
} | ||
} |
8
11
145388
3172
+ Addediconv-lite@0.6.2(transitive)
- Removediconv-lite@0.5.0(transitive)
Updatediconv-lite@0.6.2