/* jshint -W078 */

'use strict';

let stream = require('stream');

function BidiTransform() {
  this._clientToServer = new stream.Transform();
  this._serverToClient = new stream.Transform();
}

BidiTransform.prototype = {

  get to() {
    return {
      client: this._serverToClient,
      server: this._clientToServer
    };
  },

  get from() {
    return {
      client: this._clientToServer,
      server: this._serverToClient
    };
  },

  set clientEndState(options) {
    for (let option in options) {
      this._clientToServer._writableState[option] = options[option];
      this._serverToClient._readableState[option] = options[option];
    }
  },

  set serverEndState(options) {
    for (let option in options) {
      this._clientToServer._readableState[option] = options[option];
      this._serverToClient._writableState[option] = options[option];
    }
  }

};

module.exports = BidiTransform;

@@ -84,16 +84,23 @@
 ansform(
+options
 ) %7B%0A  th
@@ -192,16 +192,157 @@
 sform();
+%0A%0A  if (options.client) %7B%0A    this.clientEndState = options.client;%0A  %7D%0A  if (options.server) %7B%0A    this.serverEndState = options.server;%0A  %7D
 %0A%7D%0A%0ABidi

Set opts from constructor