<commit_before>'use strict';

const resolve = require('resolve');


/**
 * Create a drop in replacement for the built in require function.
 * Modules will be looked for as if the current directory is the
 * directory specified by `rootpath`.
 *
 * @param String rootpath Path to resolve modules relative to.
 * @returns function A function with the same interface as the built in require function.
 *
 * @example
 *
 * let cachelessRequire = require('./lib/cacheless-require')(__dirname);
 *
 * let _ = cachelessRequire('lodash');
 */
module.exports = function createCachelessRequire(rootpath) {

  let resolveRelative = filePath => resolve.sync(filePath, {
    basedir: rootpath,
  });

  function cachelessRequire(filePath = '') {

    for (const modulePath : Object.keys(require.cache)) {
      delete require.cache[modulePath];
    }

    return require(resolveRelative(filePath));
  }

  cachelessRequire.resolve = resolveRelative;

  return cachelessRequire;
}<commit_msg>Oops - replaces java for loop with javascript one<commit_after>'use strict';

const resolve = require('resolve');


/**
 * Create a drop in replacement for the built in require function.
 * Modules will be looked for as if the current directory is the
 * directory specified by `rootpath`.
 *
 * @param String rootpath Path to resolve modules relative to.
 * @returns function A function with the same interface as the built in require function.
 *
 * @example
 *
 * let cachelessRequire = require('./lib/cacheless-require')(__dirname);
 *
 * let _ = cachelessRequire('lodash');
 */
module.exports = function createCachelessRequire(rootpath) {

  let resolveRelative = filePath => resolve.sync(filePath, {
    basedir: rootpath,
  });

  function cachelessRequire(filePath = '') {

    for (const modulePath of Object.keys(require.cache)) {
      delete require.cache[modulePath];
    }

    return require(resolveRelative(filePath));
  }

  cachelessRequire.resolve = resolveRelative;

  return cachelessRequire;
}
{'fraction_non_alphanumeric': 0.10336176618163573, 'fraction_numerical': 0.0, 'mean_word_length': 4.16580310880829, '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': '738273', 'n_tokens_mistral': 543, 'n_tokens_neox': 524, 'n_words': 176}