<commit_before>"use strict";

var request = require('request');
var async = require('async');
var fs = require('fs');
var parser = require(__dirname + '/../parsers/publicsuffix-org.js');

module.exports = function(config){

  /**
   *
   * @param {string} provider
   * @param {object} config
   * @return {string}
   */
  function computeProvider(provider, config){
    var defaultProvider = config.default_provider;

    return provider && config.providers[provider] ? provider : defaultProvider;
  }

  return {
    run: function runUpdater(provider){
      var provider = computeProvider(provider, config);
      var url = config.providers[provider];

      console.log('Requesting update from ['+ url +'].');

      request.get(url, function (err, response, body) {
        var queue, tlds;

        if (err) {
          throw new Error(err);
        }

        tlds = parser.parse(body);
        queue = async.queue(function(exportTask, callback){
          console.log('- processing '+ exportTask.name +'…');

          var task_result = exportTask(tlds);
          var filename = task_result[0];
          var data = task_result[1];

          data = JSON.stringify(data);

          fs.writeFile('dist/'+filename, data, 'utf-8', callback);
        }, 5);

        queue.drain = function(){
          console.log('Update complete.')
        };

        queue.push(require(__dirname + '/../exports/index.js'));
      });
    }
  };
};<commit_msg>Fixing jshint warnings.<commit_after>"use strict";

var request = require('request');
var async = require('async');
var fs = require('fs');
var parser = require(__dirname + '/../parsers/publicsuffix-org.js');

module.exports = function(config){

  /**
   *
   * @param {string} provider
   * @param {object} config
   * @return {string}
   */
  function computeProvider(provider, config){
    var defaultProvider = config.default_provider;

    return provider && config.providers[provider] ? provider : defaultProvider;
  }

  return {
    run: function runUpdater(provider){
      provider = computeProvider(provider, config);
      var url = config.providers[provider];

      console.log('Requesting update from ['+ url +'].');

      request.get(url, function (err, response, body) {
        var queue, tlds;

        if (err) {
          throw new Error(err);
        }

        tlds = parser.parse(body);
        queue = async.queue(function(exportTask, callback){
          console.log('- processing '+ exportTask.name +'…');

          var task_result = exportTask(tlds);
          var filename = task_result[0];
          var data = task_result[1];

          data = JSON.stringify(data);

          fs.writeFile('dist/'+filename, data, 'utf-8', callback);
        }, 5);

        queue.drain = function(){
          console.log('Update complete.');
        };

        queue.push(require(__dirname + '/../exports/index.js'));
      });
    }
  };
};
{'fraction_non_alphanumeric': 0.15036045314109167, 'fraction_numerical': 0.0027463096464126332, 'mean_word_length': 2.5754601226993863, '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': '2056514', 'n_tokens_mistral': 854, 'n_tokens_neox': 826, 'n_words': 191}