Skip to content

Commit

Permalink
Put reading and writing sides of transformers into different objectMo…
Browse files Browse the repository at this point in the history
…de states
  • Loading branch information
codeaholics committed Aug 13, 2013
1 parent cabd248 commit f714889
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/parser.js
Expand Up @@ -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 || {};

Expand Down
8 changes: 5 additions & 3 deletions lib/protocol-emitter.js
Expand Up @@ -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 || {};

Expand All @@ -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');
Expand Down
4 changes: 3 additions & 1 deletion lib/writer.js
Expand Up @@ -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 || {};

Expand Down

0 comments on commit f714889

Please sign in to comment.