<commit_before>var getFoo = function() {
  return 42;
};

var toUrl = function(str) {
  // TODO: extrapolate replacement out
  return str.replace(new RegExp('\\s', 'g'), '-').toLowerCase();
}

var squeeze = function(str, range) {
  let chars = [...str];
  var rangeRegexp = new RegExp(`[${range}]`, 'g');
  for (var j = 0; j < chars.length; j++) {
    if (chars[j] === chars[j+1]) {
      // if range === undefined i.e. false
      if (!range) {
        chars[j] = '';
      } else if (chars[j].match(rangeRegexp)) {
        chars[j] = '';
      }
    }
  }
  return chars.join('');
}

var changeMoney = function(str) {
  var exps = [
    {regex: /\$(\d+)/, replace: '$1 dollars'},
    {regex: /\€(\d+)/, replace: '$1 euros'},
    {regex: /\£(\d+)/, replace: '$1 pounds'}
  ];
  for (var i = 0; i < exps.length; i++) {
    str = str.replace(exps[i].regex, exps[i].replace);
  }
  return str;
}

export { getFoo, toUrl, squeeze, changeMoney }<commit_msg>:seven: Lets & fat arrows<commit_after>let getFoo = () => 42;

let toUrl = str => str.replace(new RegExp('\\s', 'g'), '-').toLowerCase();

let squeeze = (str, range) => {
  let chars = [...str];
  let rangeRegexp = new RegExp(`[${range}]`, 'g');
  for (let j = 0; j < chars.length; j++) {
    if (chars[j] === chars[j+1]) {
      // if range === undefined i.e. false
      if (!range) {
        chars[j] = '';
      } else if (chars[j].match(rangeRegexp)) {
        chars[j] = '';
      }
    }
  }
  return chars.join('');
}

let changeMoney = str => {
  let exps = [
    {regex: /\$(\d+).(\d\d)/, replace: '$1 dollars $2 cents'},
    {regex: /\$(\d+)/, replace: '$1 dollars'},
    {regex: /\€(\d+).(\d\d)/, replace: '$1 euro $2 cents'},
    {regex: /\€(\d+)/, replace: '$1 euro'},
    {regex: /\£(\d+).(\d\d)/, replace: '$1 pounds $2 pence'},
    {regex: /\£(\d+)/, replace: '$1 pounds'}
  ];
  for (let i = 0; i < exps.length; i++) {
    str = str.replace(exps[i].regex, exps[i].replace);
  }
  return str;
}

export { getFoo, toUrl, squeeze, changeMoney }
{'fraction_non_alphanumeric': 0.24751491053677932, 'fraction_numerical': 0.010934393638170975, 'mean_word_length': 2.594642857142857, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2915052', 'n_tokens_mistral': 807, 'n_tokens_neox': 766, 'n_words': 197}