<commit_before>var path = require('path'),
  _ = require('underscore'),
  store = {};

exports.get = function(source){
  if (!path.extname(source)){
    source += (source.substr(source.length - 1, 1) === '/' ? '/' : '') + 'index.html';
  }

  return store[source];
};

exports.set = function(source, callback){
  if (!path.extname(source)){
    source += (source.substr(source.length - 1, 1) === '/' ? '' : '/') + 'index.html';
  }

  if (_.isFunction(callback)){
    store[source] = callback;
  } else {
    store[source] = function(func){
      func(null, callback);
    };
  }
};

exports.list = function(){
  return store;
};<commit_msg>separate route format function<commit_after>var path = require('path'),
  _ = require('underscore'),
  store = {};

var format = function(str){
  if (str.substr(0, 1) === '/') str = str.substring(1);

  if (!path.extname(str)){
    var last = str.substr(str.length - 1, 1);
    if (last && last !== '/') str += '/';
    str += 'index.html';
  }

  return str;
};

exports.get = function(source){
  return store[format(source)];
};

exports.set = function(source, callback){
  source = format(source);

  if (_.isFunction(callback)){
    store[source] = callback;
  } else {
    store[source] = function(func){
      func(null, callback);
    };
  }
};

exports.list = function(){
  return store;
};
{'fraction_non_alphanumeric': 0.20911127707244212, 'fraction_numerical': 0.006721433905899925, 'mean_word_length': 3.3790849673202614, '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': '2071186', 'n_tokens_mistral': 465, 'n_tokens_neox': 449, 'n_words': 92}