diff --git a/deps/dicer/lib/Dicer.js b/deps/dicer/lib/Dicer.js index 9d580cb..0d1f994 100644 --- a/deps/dicer/lib/Dicer.js +++ b/deps/dicer/lib/Dicer.js @@ -139,7 +139,7 @@ Dicer.prototype._ignore = function() { }; Dicer.prototype._oninfo = function(isMatch, data, start, end) { - var buf, self = this, i = 0, r, ev, shouldWriteMore = true; + var buf, self = this, i = 0, r, shouldWriteMore = true; if (!this._part && this._justMatched && data) { while (this._dashes < 2 && (start + i) < end) { @@ -175,9 +175,10 @@ Dicer.prototype._oninfo = function(isMatch, data, start, end) { this._part._read = function(n) { self._unpause(); }; - ev = this._isPreamble ? 'preamble' : 'part'; - if (this._events[ev]) - this.emit(ev, this._part); + if (this._isPreamble && this._events['preamble']) + this.emit('preamble', this._part); + else if (this._isPreamble !== true && this._events['part']) + this.emit('part', this._part); else this._ignore(); if (!this._isPreamble)