{"size": 1145, "ext": "js", "max_stars_repo_path": "lib/protocols/base.js", "max_stars_repo_name": "Sonivaibhav26/willa", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/protocols/base.js", "max_issues_repo_name": "Sonivaibhav26/willa", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/protocols/base.js", "max_forks_repo_name": "Sonivaibhav26/willa", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.0877192982, "max_line_length": 88, "alphanum_fraction": 0.6131004367}
const stream = require('stream');

module.exports = Base => class BaseProtocol extends Base {
  constructor (options) {
    super(options);
    if (new.target === BaseProtocol) {
      throw new Error("Cannot construct Base Drape instances directly");
    }
    if(!this._isStream()) {
      throw Error('Base protocol can only extend stream.Stream class');
    } 
  }

  _isStream () {
    return this instanceof stream.Stream;
  }

  _isReadable () {
    return typeof this._read === 'function' && typeof this._readableState === 'object';
  }

  _isWritable () {
    return typeof this._write === 'function' && typeof this._writableState === 'object';
  }

  _isDuplex () {
    return this._isReadable() && this._isWritable();
  }

  _isTransform () {
    return this._isDuplex() && this._transform === 'function';
  }

  _isMergable () {
    return this._merge === 'function';
  }

  _isForkable () {
    return this._fork === 'function';
  }

  _isParallel () {
    return this._parallelize === 'function';
  }

  _isFlowable () {
    return false;
  }

  _isSoureceable () {
    return false;
  }

  _isSinkable () {
    return false;
  }
}