Permalink
Browse files

Parser: move internal buffer updating

  • Loading branch information...
mscdex committed Aug 1, 2013
1 parent 78a2791 commit 552875b3216829c7788bfff333341099127fa589
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/parser.js
View
@@ -50,11 +50,11 @@ Parser.prototype._write = function(chunk, encoding, cb) {
reRmLeadCode += m[1];
reRmLeadCode += '(?: |\\-)';
reRmLeadCode = new RegExp(reRmLeadCode, 'g');
- this._buffer = this._buffer.replace(reRmLeadCode, '$1').trim();
-
- debug&&debug('[parser] Response: code=' + code + ', buffer=' + inspect(this._buffer));
- this.emit('response', code, this._buffer);
+ var text = this._buffer.replace(reRmLeadCode, '$1').trim();
this._buffer = rest;
+
+ debug&&debug('[parser] Response: code=' + code + ', buffer=' + inspect(text));
+ this.emit('response', code, text);
}
cb();

0 comments on commit 552875b

Please sign in to comment.