<commit_before>'use strict';

/**
 * Transform a list of files that can be an array or a string into a string
 * that can be passed to the `run` function as part of the `command` parameter.
 * @param  {string|array} files
 * @return {string}
 */
module.exports = function (files) {

  if (files === undefined) {
    return '';
  }

  var toProcess = '';
  if (files instanceof Array) {
    files.forEach(function (f) {
      toProcess += '"' + f.replace(/\^/g, '^^').replace(/\&/g, '^&').replace(/\</g, '^<').replace(/\>/g, '^>').replace(/\|/g, '^|').replace(/\%/g, '%%') + '" ';
    });
    toProcess = toProcess.trim();
  } else {
    toProcess = '"' + files + '"';
  }
  return toProcess;

};<commit_msg>Now also escapes files in string format<commit_after>'use strict';

/**
 * Transform a list of files that can be an array or a string into a string
 * that can be passed to the `run` function as part of the `command` parameter.
 * @param  {string|array} files
 * @return {string}
 */
module.exports = function (files) {

  if (files === undefined) {
    return '';
  }

  var toProcess = '';
  if (files instanceof Array) {
    files.forEach(function (f) {
      toProcess += '"' + f.replace(/\^/g, '^^').replace(/\&/g, '^&').replace(/\</g, '^<').replace(/\>/g, '^>').replace(/\|/g, '^|').replace(/\%/g, '%%') + '" ';
    });
    toProcess = toProcess.trim();
  } else {
    toProcess = '"' + files.replace(/\^/g, '^^').replace(/\&/g, '^&').replace(/\</g, '^<').replace(/\>/g, '^>').replace(/\|/g, '^|').replace(/\%/g, '%%') + '"';
  }
  return toProcess;

};
{'fraction_non_alphanumeric': 0.2515964240102171, 'fraction_numerical': 0.0, 'mean_word_length': 2.9670886075949365, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3546052', 'n_tokens_mistral': 565, 'n_tokens_neox': 551, 'n_words': 143}