<commit_before>var assert = require('assert');
var Address = require('satoshi-address');
var Hash = require('satoshi-hash');
var Script = require('satoshi-script');

function MSKey(options) {
  assert(options, 'Missing options');
  assert(options.keys && options.keys.length > 0, 'Missing keys');
  assert(options.keys.length < 16, 'Too many keys');
  assert(options.m, 'Missing number of required signatures');
  assert(options.m <= options.keys.length, 'Number of required signatures cannot be higher than the number of keys');

  this.m = options.m;
  this.keys = options.keys;
  this.network = this.keys[0].network;
}

MSKey.prototype.getAddress = function () {
  var pubkeys = this.keys.map(function (key) { return key.pub; });
  var redeemScript = Script.createMultisigOutput(this.m, pubkeys);
  var hash = Hash.hash160(redeemScript.buffer);
  return new Address(hash, 'scripthash', this.network);
};

MSKey.prototype.derive = function (index) {
  var derived = this.keys.map(function (key) {
    return key.derive(index);
  });
  return new MSKey({ m: this.m, keys: derived });
};

MSKey.prototype.deriveHardened = function (index) {
  var derived = this.keys.map(function (key) {
    return key.deriveHardened(index);
  });
  return new MSKey({ m: this.m, keys: derived });
};

module.exports = MSKey;
<commit_msg>refactor: remove assert<commit_after>var Address = require('satoshi-address');
var Hash = require('satoshi-hash');
var Script = require('satoshi-script');

function MSKey(options) {
  if (!options) {
    throw new Error('Missing options');
  }
  if (!options.keys || options.keys.length === 0) {
    throw new Error('Missing keys');
  }
  if (options.keys.length >= 16) {
    throw new Error('Too many keys');
  }
  if (typeof options.m !== 'number') {
    throw new Error('Missing number of required signatures');
  }
  if (options.m < 0 || options.m > options.keys.length) {
    throw new Error('Invalid number of required signatures');
  }

  this.m = options.m;
  this.keys = options.keys;
  this.network = this.keys[0].network;
}

MSKey.prototype.getAddress = function () {
  var pubkeys = this.keys.map(function (key) { return key.pub; });
  var redeemScript = Script.createMultisigOutput(this.m, pubkeys);
  var hash = Hash.hash160(redeemScript.buffer);
  return new Address(hash, 'scripthash', this.network);
};

MSKey.prototype.derive = function (index) {
  var derived = this.keys.map(function (key) {
    return key.derive(index);
  });
  return new MSKey({ m: this.m, keys: derived });
};

MSKey.prototype.deriveHardened = function (index) {
  var derived = this.keys.map(function (key) {
    return key.deriveHardened(index);
  });
  return new MSKey({ m: this.m, keys: derived });
};

module.exports = MSKey;

{'fraction_non_alphanumeric': 0.1540983606557377, 'fraction_numerical': 0.00546448087431694, 'mean_word_length': 4.2106261859582546, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '7004075', 'n_tokens_mistral': 896, 'n_tokens_neox': 876, 'n_words': 226}