function WatcherReadable (stream, opts) { 
  if (!(this instanceof WatcherReadable)) return new WatcherReadable(stream, opts);
  var self = this;

  opts = opts || {};
  opts.objectMode = true;
  Readable.call(this, opts);

  // null mostly for testing
  if (opts.interval === null) this._interval = null;
  else                        this._interval = opts.interval || 500;

  this._properties = { 
      readable: opts.readable || defaultStateProps
    , writable: opts.writable || defaultStateProps
  };

  var info = {};
  if (stream._readableState) info.readable = stream._readableState;
  if (stream._writableState) info.writable = stream._writableState;
  this._streamInfo = info;

  this._label = opts.label || stream.constructor.name + '(S)';
  this._ending = false;
}
/**
 * Creates a readable stream that streams readable/writable state changes of the given stream.
 * 
 * @name WatcherReadable
 * @function
 * @param stream {Stream} a readable and/or writable stream whose states to stream
 * @param opts {Object} with the following properties
 *  - interval {Number} the millisecond interval at which state updates are streamed (default: 500)
 *  - readable {Array[String]} names of readable properties that should be included in the state stream (default: highWaterMark, bufferLength)
 *  - writable {Array[String]} names of writable properties that should be included in the state stream (default: highWaterMark, bufferLength)
 *  - label {String} label that is emitted with every state update (default: the name of the stream constructor + (S))
 * @return {Stream} WatcherReadable that emits state updates.
 */
Creates a readable stream that streams readable/writable state changes of the given stream.


Creates a readable stream that streams readable / writable state changes of the given stream .
function WatcherReadable (stream, opts) { 
  if (!(this instanceof WatcherReadable)) return new WatcherReadable(stream, opts);
  var self = this;
  opts = opts || {};
  opts.objectMode = true;
  Readable.call(this, opts);
  if (opts.interval === null) this._interval = null;
  else                        this._interval = opts.interval || 500;
  this._properties = { 
      readable: opts.readable || defaultStateProps
    , writable: opts.writable || defaultStateProps
  };
  var info = {};
  if (stream._readableState) info.readable = stream._readableState;
  if (stream._writableState) info.writable = stream._writableState;
  this._streamInfo = info;
  this._label = opts.label || stream.constructor.name + '(S)';
  this._ending = false;
}
function WatcherReadable ( stream , opts ) { if ( ! ( this instanceof WatcherReadable ) ) return new WatcherReadable ( stream , opts ) ; var self = this ; opts = opts || { } ; opts . objectMode = true ; Readable . call ( this , opts ) ; if ( opts . interval === null ) this . _interval = null ; else this . _interval = opts . interval || 500 ; this . _properties = { readable : opts . readable || defaultStateProps , writable : opts . writable || defaultStateProps } ; var info = { } ; if ( stream . _readableState ) info . readable = stream . _readableState ; if ( stream . _writableState ) info . writable = stream . _writableState ; this . _streamInfo = info ; this . _label = opts . label || stream . constructor . name + '(S)' ; this . _ending = false ; }
Creates a readable stream that streams readable/writable state changes of the given stream.
Creates a readable stream that streams readable / writable state changes of the given stream .
// null mostly for testing