mailparser
Advanced tools
Comparing version 0.3.6 to 0.4.0
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
/* | ||
@@ -115,3 +117,3 @@ * More info at: http://phpjs.org | ||
*/ | ||
this.strtotime = function(str, now) { | ||
module.exports.strtotime = function(str, now) { | ||
// http://kevin.vanzonneveld.net | ||
@@ -215,3 +217,3 @@ // + original by: Caio Ariede (http://caioariede.com) | ||
var diff = day - now.getDay(); | ||
if (diff == 0) { | ||
if (diff === 0) { | ||
diff = 7 * num; | ||
@@ -264,3 +266,3 @@ } else if (diff > 0) { | ||
match = strTmp.match(/^(\d{2,4}-\d{2}-\d{2})(?:\s(\d{1,2}:\d{2}(:\d{2})?)?(?:\.(\d+))?)?$/); | ||
if (match != null) { | ||
if (match) { | ||
if (!match[2]) { | ||
@@ -296,3 +298,3 @@ match[2] = '00:00:00'; | ||
match = strTmp.match(new RegExp(regex, 'gi')); // Brett: seems should be case insensitive per docs, so added 'i' | ||
if (match == null) { | ||
if (!match) { | ||
return false; | ||
@@ -308,2 +310,2 @@ } | ||
return (now.getTime()/1000); | ||
} | ||
}; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
@@ -113,3 +114,7 @@ /** | ||
if( this._write(chunk, encoding) ){ | ||
process.nextTick(this._process.bind(this)); | ||
if(typeof setImmediate == "function"){ | ||
setImmediate(this._process.bind(this)); | ||
}else{ | ||
process.nextTick(this._process.bind(this)); | ||
} | ||
} | ||
@@ -134,3 +139,7 @@ return true; | ||
process.nextTick(this._process.bind(this, true)); | ||
if(typeof setImmediate == "function"){ | ||
setImmediate(this._process.bind(this, true)); | ||
}else{ | ||
process.nextTick(this._process.bind(this, true)); | ||
} | ||
}; | ||
@@ -235,3 +244,7 @@ | ||
this._state = STATES.finished; | ||
process.nextTick(this._processMimeTree.bind(this)); | ||
if(typeof setImmediate == "function"){ | ||
setImmediate(this._processMimeTree.bind(this)); | ||
}else{ | ||
process.nextTick(this._processMimeTree.bind(this)); | ||
} | ||
} | ||
@@ -865,3 +878,6 @@ | ||
}else if(this._currentNode.meta.transferEncoding == "base64"){ | ||
this._currentNode.content = new Buffer(this._currentNode.content, "base64"); | ||
// WTF? if newlines are not removed, the resulting hash is *always* different | ||
this._currentNode.content = new Buffer(this._currentNode.content.replace(/\s+/g, ""), "base64"); | ||
}else{ | ||
@@ -976,3 +992,7 @@ this._currentNode.content = new Buffer(this._currentNode.content, "binary"); | ||
process.nextTick(this.emit.bind(this, "end", returnValue)); | ||
if(typeof setImmediate == "function"){ | ||
setImmediate(this.emit.bind(this, "end", returnValue)); | ||
}else{ | ||
process.nextTick(this.emit.bind(this, "end", returnValue)); | ||
} | ||
}; | ||
@@ -979,0 +999,0 @@ |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
var Stream = require('stream').Stream, | ||
@@ -2,0 +4,0 @@ utillib = require('util'), |
{ | ||
"name": "mailparser", | ||
"description": "Asynchronous and non-blocking parser for mime encoded e-mail messages", | ||
"version": "0.3.6", | ||
"version": "0.4.0", | ||
"author" : "Andris Reinman", | ||
@@ -31,5 +31,2 @@ "maintainers":[ | ||
}, | ||
"optionalDependencies":{ | ||
"iconv": "*" | ||
}, | ||
"devDependencies": { | ||
@@ -36,0 +33,0 @@ "nodeunit": "*" |
@@ -20,4 +20,8 @@ MailParser | ||
If you want to send e-mail instead of parsing it, check out my other module [Nodemailer](/andris9/Nodemailer). | ||
If you want to send e-mail instead of parsing it, check out my other module [Nodemailer](https://github.com/andris9/Nodemailer). | ||
## ICONV NOTICE | ||
Since v0.4 `node-iconv` is not included by default as a dependency. If you need to support encodings not covered by `iconv-lite` you should add `iconv` as a dependency to your own project so `mailparser` could pick it up. | ||
## Support mailparser development | ||
@@ -24,0 +28,0 @@ |
@@ -43,3 +43,7 @@ var MailParser = require("../lib/mailparser").MailParser, | ||
mailparser.write(chunk, 'utf8'); | ||
process.nextTick(writeNextChunk); | ||
if(typeof setImmediate == "function"){ | ||
setImmediate(writeNextChunk); | ||
}else{ | ||
process.nextTick(writeNextChunk); | ||
} | ||
} else { | ||
@@ -54,3 +58,8 @@ mailparser.end(); | ||
}); | ||
process.nextTick(writeNextChunk); | ||
if(typeof setImmediate == "function"){ | ||
setImmediate(writeNextChunk); | ||
}else{ | ||
process.nextTick(writeNextChunk); | ||
} | ||
}, | ||
@@ -57,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
127827
3
2756
222
10