<commit_before>/**
 _ __  __ __  __  ____      _    ____ _____    __  ______ __ __
 | |  \/  |  \/  |/ () \    | |__| ===|_   _|   \ \/ / () |  |  |
 |_|_|\/|_|_|\/|_/__/\__\   |____|____| |_|      |__|\____/\___/

 **/

var obj = (function() {
  var mocks, modules = {};

  ImmaLetYou = function(opts) {
    this.basePath = opts.basePath || '';
    this.defaultMock = opts.defaultMock || {};
  };

  ImmaLetYou.prototype.finish = function(path) {
    mocks = {};
    this.path = path;
    return this;
  };

  ImmaLetYou.prototype.ofAllTime = function() {
    var path = this.basePath + this.path;
    var self = this;
    var mockRequire = function(path) {
      return mocks[path] || self.defaultMock;
    };
    var moduleReturn;
    try {
      moduleReturn = modules[path](mockRequire);
    } catch(e) {
      var paths = '';
      for(var i  in modules) {
        paths += i + '\n';
      }

      throw Error('Could not find module with path ' + path + '\nRegistered paths are:\n' + paths);
    }

    return moduleReturn;
  };

  ImmaLetYou.prototype.but = function(path, mock) {
    mocks[path] = mock;
    return this;
  };

  define = function(callback) {
    var scripts = document.getElementsByTagName('script');
    var last = scripts[scripts.length - 1];
    var fullPath = last.src;
    var requirePath = fullPath.replace(/http:\/\/.*\/base\//g,'');
    requirePath = requirePath.replace(/\.js\?.*/g,'');
    modules[requirePath] = callback;
  };
  return {
    ImmaLetYou: ImmaLetYou,
    define: define
  };
})();<commit_msg>Should have had a try catch, instead check for the module being defined.<commit_after>/**
 _ __  __ __  __  ____      _    ____ _____    __  ______ __ __
 | |  \/  |  \/  |/ () \    | |__| ===|_   _|   \ \/ / () |  |  |
 |_|_|\/|_|_|\/|_/__/\__\   |____|____| |_|      |__|\____/\___/

 **/

var obj = (function() {
  var mocks, modules = {};

  ImmaLetYou = function(opts) {
    this.basePath = opts.basePath || '';
    this.defaultMock = opts.defaultMock || {};
  };

  ImmaLetYou.prototype.finish = function(path) {
    mocks = {};
    this.path = path;
    return this;
  };

  ImmaLetYou.prototype.ofAllTime = function() {
    var path = this.basePath + this.path;
    var self = this;
    var mockRequire = function(path) {
      return mocks[path] || self.defaultMock;
    };
    var moduleReturn;
    var theModule = modules[path];
    if(theModule) {
      moduleReturn = theModule(mockRequire);
    } else {
      var paths = '';
      for(var i  in modules) {
        paths += i + '\n';
      }

      throw Error('Could not find module with path ' + path + '\nRegistered paths are:\n' + paths);
    }

    return moduleReturn;
  };

  ImmaLetYou.prototype.but = function(path, mock) {
    mocks[path] = mock;
    return this;
  };

  define = function(callback) {
    var scripts = document.getElementsByTagName('script');
    var last = scripts[scripts.length - 1];
    var fullPath = last.src;
    var requirePath = fullPath.replace(/http:\/\/.*\/base\//g,'');
    requirePath = requirePath.replace(/\.js\?.*/g,'');
    modules[requirePath] = callback;
  };
  return {
    ImmaLetYou: ImmaLetYou,
    define: define
  };
})();
{'fraction_non_alphanumeric': 0.17022613065326633, 'fraction_numerical': 0.000628140703517588, 'mean_word_length': 2.3039419087136928, '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': '2842923', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1079, 'n_words': 205}