code: function clearRequireCacheInDir(dir, extension) {
  
    var options = {
      cwd: dir
    };
  
    // find all files with the `extension` in the express view directory
    // and clean them out of require's cache.
    var files = glob.sync('**/*.' + extension, options);
  
    files.map(function(file) {
      clearRequireCache(dir + path.sep + (file.split(/\\|\//g).join(path.sep)));
    });
  }
docs: clears require cache of files that have extension `extension` from a given directory `dir`.