<commit_before>
// Module for parsing JSON into CSV
var csvConverter = {
  convert: function (objArray) {
    var array = typeof objArray !== 'object' ? JSON.parse(objArray) : objArray;
    //Assume that the headers of the document are equal to the keys in the JSON object. 
    var headers = Object.keys(array[0]);
    return this.parseHeaders(headers, array);
  },
  
  parseHeaders: function(headers, array) {
    //Push the headers into the CSV string. 
    var str = '';
    headers.forEach(function(item) {
      str += item + ',';
    });
    str += '\r\n';
    return this.parseBody(array, str);
  },
 
  parseBody: function(array, str) {
    var regex, value, line;

    array.forEach(function (item, index) {
      line = '';
      for ( index in item ) {
        if ( line !== '' ) { 
          line += ','; 
        }
          regex = /\,/;
          value = item[index];
       
        if (typeof value  === "string") {
          // If the value contained in the JSON object is a string:
          // Perform a regex test to check and see if the value has a comma already in place and escape the value. 
          // e.g. "<NAME>" as a value should not be separated two different columns. 
          value = regex.test(value) ? '"' + value + '"' : value;
        }
        line += value;
      }
      str += line + '\r\n';
    });
    return this.open(str);
  },
  
  open: function(str) {
    if (Object.hasOwnProperty.call(window, "ActiveXObject") && !window.ActiveXObject) 
    {  // Determine if client is IE11
      var blob = new Blob([csvString], {
        type: "text/csv;charset=utf-8;"
      });
      window.navigator.msSaveBlob(blob, "tcm-01.csv");
      } 
      else {
       window.open("data:text/csv;charset=utf-8," + escape(csvString));
    }
  }
}<commit_msg>fix argument to open function<commit_after>
// Module for parsing JSON into CSV
var csvConverter = {
  convert: function (objArray) {
    var array = typeof objArray !== 'object' ? JSON.parse(objArray) : objArray;
    //Assume that the headers of the document are equal to the keys in the JSON object. 
    var headers = Object.keys(array[0]);
    return this.parseHeaders(headers, array);
  },
  
  parseHeaders: function(headers, array) {
    //Push the headers into the CSV string. 
    var str = '';
    headers.forEach(function(item) {
      str += item + ',';
    });
    str += '\r\n';
    return this.parseBody(array, str);
  },
 
  parseBody: function(array, str) {
    var regex, value, line;

    array.forEach(function (item, index) {
      line = '';
      for ( index in item ) {
        if ( line !== '' ) { 
          line += ','; 
        }
          regex = /\,/;
          value = item[index];
       
        if (typeof value  === "string") {
          // If the value contained in the JSON object is a string:
          // Perform a regex test to check and see if the value has a comma already in place and escape the value. 
          // e.g. "<NAME>" as a value should not be separated two different columns. 
          value = regex.test(value) ? '"' + value + '"' : value;
        }
        line += value;
      }
      str += line + '\r\n';
    });
    return this.open(str);
  },
  
  open: function(csvString) {
    if (Object.hasOwnProperty.call(window, "ActiveXObject") && !window.ActiveXObject) 
    {  // Determine if client is IE11
      var blob = new Blob([csvString], {
        type: "text/csv;charset=utf-8;"
      });
      window.navigator.msSaveBlob(blob, "tcm-01.csv");
      } 
      else {
       window.open("data:text/csv;charset=utf-8," + escape(csvString));
    }
  }
}
{'fraction_non_alphanumeric': 0.1407202216066482, 'fraction_numerical': 0.003878116343490305, 'mean_word_length': 2.1264069264069265, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3651271', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1084, 'n_words': 330}