From af0c191ec1e13fd8fbd53b719b2cd3523e5cef70 Mon Sep 17 00:00:00 2001 From: Brian White Date: Tue, 24 Jul 2012 21:40:46 -0400 Subject: [PATCH] Better "constant" variable naming in mimeparser --- lib/mimeparser.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/mimeparser.js b/lib/mimeparser.js index b097168..cb00370 100644 --- a/lib/mimeparser.js +++ b/lib/mimeparser.js @@ -10,7 +10,7 @@ var CR = 13, COLON = 58, SPACE = 32, TAB = 9, - RE_FOLD = /\r\n\s+/g; + REGEXP_FOLD = /\r\n\s+/g; var MIMEParser = module.exports = function() { this._state = PARSE_HEADER_NAME; @@ -19,8 +19,9 @@ var MIMEParser = module.exports = function() { this._sawCR = false; this._sawLF = false; this._needUnfold = false; -} +}; inherits(MIMEParser, EventEmitter); + MIMEParser.prototype.execute = function(b, start, end) { if (this._state == PARSE_BODY) { var chunk; @@ -96,7 +97,7 @@ MIMEParser.prototype.execute = function(b, start, end) { else if (finished) { this._hdrval += b.toString('ascii', start, (i < end ? i - 2 : end)); if (this._needUnfold) - this._hdrval = this._hdrval.replace(RE_FOLD, ' '); + this._hdrval = this._hdrval.replace(REGEXP_FOLD, ' '); this.emit('header', this._hdrname, this._hdrval.trim()); this._hdrname = ''; this._hdrval = ''; @@ -111,6 +112,7 @@ MIMEParser.prototype.execute = function(b, start, end) { } } }; + MIMEParser.prototype.finish = function() { this._state = PARSE_HEADER_NAME; this._hdrname = '';