<commit_before>_ = require 'lodash'
moment = require 'moment'
async = require 'async'

module.exports = {

  ###*
   * Function Preset ajax request.
   * @param {String} URL
   * @callback {Function} Callback
  ###
  ajaxRequest: (url, cb) ->
    $.ajax({url: url, timeout: 10000})
      .fail (err) ->
        console.log err
        cb err
      .done (body) ->
        cb null, body


  ###*
   * Function Adds % to string.
   * @param {String} Text.
   * @returns {String} Formated String.
  ###<commit_msg>Ajax retry<commit_after>_ = require 'lodash'
moment = require 'moment'
async = require 'async'

module.exports = {

  ###*
   * Function Preset ajax request.
   * @param {String} URL
   * @callback {Function} Callback
  ###
  ajaxRequest: (url, done) ->
    async.retry 3, (step) ->
      $.ajax({url: url, timeout: 10000})
        .fail (err) ->
          console.log err
          step err
        .done (body) ->
          step null, body

    , (err, results) ->
      console.log err if err
      return done(err) if err
      done null, results


  ###*
   * Function Adds % to string.
   * @param {String} Text.
   * @returns {String} Formated String.
  ###
{'fraction_non_alphanumeric': 0.14808510638297873, 'fraction_numerical': 0.009361702127659575, 'mean_word_length': 2.2131147540983607, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4502187', 'n_tokens_mistral': 402, 'n_tokens_neox': 378, 'n_words': 115}