<commit_before>module.exports.rewire = function(module, autoReset, afterEachHook) {
  var rewiredNames = [];
  if (typeof autoReset === 'undefined') {
    autoReset = true;
  }
  if (typeof afterEachHook === 'undefined') {
    afterEachHook = afterEach;
  }

  function reset() {
    rewiredNames.forEach(function(name) {
      module.__ResetDependency__(name);
    });
    rewiredNames.length = 0;
  }

  if (autoReset) {
    afterEachHook(reset);
  }

  return {
    replace: function(name, replacement) {
      module.__Rewire__(name, replacement);
      rewiredNames.push(name);
      return this;
    },

    replaceMap: function(replacementMap) {
      Object.keys(replacementMap).forEach(function(name) {
        this.replace(name, replacementMap[name]);
      });
      return this;
    },

    reset: function() {
      reset();
      return this;
    }
  };
};<commit_msg>Fix execution context in replaceMap<commit_after>module.exports.rewire = function(module, autoReset, afterEachHook) {
  var rewiredNames = [];
  if (typeof autoReset === 'undefined') {
    autoReset = true;
  }
  if (typeof afterEachHook === 'undefined') {
    afterEachHook = afterEach;
  }

  function reset() {
    rewiredNames.forEach(function(name) {
      module.__ResetDependency__(name);
    });
    rewiredNames.length = 0;
  }

  if (autoReset) {
    afterEachHook(reset);
  }

  return {
    replace: function(name, replacement) {
      module.__Rewire__(name, replacement);
      rewiredNames.push(name);
      return this;
    },

    replaceMap: function(replacementMap) {
      var that = this;
      Object.keys(replacementMap).forEach(function(name) {
        that.replace(name, replacementMap[name]);
      });
      return this;
    },

    reset: function() {
      reset();
      return this;
    }
  };
};
{'fraction_non_alphanumeric': 0.13266998341625208, 'fraction_numerical': 0.001105583195135434, 'mean_word_length': 2.9092872570194386, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3556204', 'n_tokens_mistral': 567, 'n_tokens_neox': 546, 'n_words': 103}