Permalink
Browse files

Put reading and writing sides of transformers into different objectMo…

…de states
  • Loading branch information...
1 parent cabd248 commit f714889f1eecb2d82dda87ac8c566ff01acc1d5a @codeaholics committed Aug 13, 2013
Showing with 11 additions and 5 deletions.
  1. +3 −1 lib/parser.js
  2. +5 −3 lib/protocol-emitter.js
  3. +3 −1 lib/writer.js
View
@@ -31,7 +31,9 @@ function Parser(options) {
return new Parser(options);
}
- Transform.call(this, {objectMode: true});
+ Transform.call(this);
+ this._writableState.objectMode = false;
+ this._readableState.objectMode = true;
options = options || {};
View
@@ -25,7 +25,9 @@ function ProtocolEmitter(options) {
return new ProtocolEmitter(options);
}
- Transform.call(this, {objectMode: true});
+ Transform.call(this);
+ this._writableState.objectMode = true;
+ this._readableState.objectMode = false;
options = options || {};
@@ -42,9 +44,9 @@ function ProtocolEmitter(options) {
}
function handleArray(obj) {
- var bufs = [];
+ var bufs = [];
- bufs.push(new Buffer('*' + obj.length, 'ascii'));;
+ bufs.push(new Buffer('*' + obj.length, 'ascii'));
bufs.push(crlf);
for (var i = 0; i < obj.length; i++) {
var value = new Buffer(obj[i], 'utf8');
View
@@ -27,7 +27,9 @@ function Writer(options) {
return new Writer(options);
}
- Transform.call(this, {objectMode: true});
+ Transform.call(this);
+ this._writableState.objectMode = true;
+ this._readableState.objectMode = false;
options = options || {};

0 comments on commit f714889

Please sign in to comment.