<commit_before>'use strict';

var check = require ('./check.js');

/*****************************************************************************/

module.exports = function (connector) {
  var api;
  var bus;

  check.verifyMethod (connector, 'wrap', 'connector');

  if (check.hasMethod (connector, 'getElectrumApi')) {
    api = connector.getElectrumApi ();
    check.verifyInterface (api, require ('./interfaces/api.js'));
  }

  if (check.hasMethod (connector, 'getElectrumBus')) {
    bus = connector.getElectrumBus ();
    check.verifyInterface (bus, require ('./interfaces/bus.js'));
  }

  this.connectors.unshift (connector);
  return this;
};

/*****************************************************************************/<commit_msg>Inject Electrum API and Bus on use.<commit_after>'use strict';

var check = require ('./check.js');

/*****************************************************************************/

module.exports = function (connector) {
  var api;
  var bus;

  check.verifyMethod (connector, 'wrap', 'connector');

  if (check.hasMethod (connector, 'getElectrumApi')) {
    api = connector.getElectrumApi ();
    check.verifyInterface (api, require ('./interfaces/api.js'));
  }

  if (check.hasMethod (connector, 'getElectrumBus')) {
    bus = connector.getElectrumBus ();
    check.verifyInterface (bus, require ('./interfaces/bus.js'));
  }

  // Everything was successfully verified; we can now proceed and alter
  // this Electrum instance:

  this.connectors.unshift (connector);

  if (api) {
    Object.keys (api).forEach (key => this[key] = api[key]);
  }
  if (bus) {
    Object.keys (bus).forEach (key => this.bus[key] = bus[key]);
  }

  return this;
};

/*****************************************************************************/
{'fraction_non_alphanumeric': 0.31046119235095615, 'fraction_numerical': 0.0, 'mean_word_length': 4.576802507836991, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '711840', 'n_tokens_mistral': 513, 'n_tokens_neox': 480, 'n_words': 115}