<commit_before>'use strict';

// Library function to load JSONP data
// Adapted from https://gist.github.com/gf3/132080/110d1b68d7328d7bfe7e36617f7df85679a08968

var loadJsonp = (function(){
  var unique = 0;
  return function(endpoint, params, callback, callbackParamName) {

    // Create unique function name
    let name = '_jsonp_' + unique++;

    // Construct URL
    let queryParams = Object.keys(params).map(function(el) {
      return escape(el) + '=' + escape(params[el]);
    }).join('&');
    queryParams += queryParams ? '&' : '';
    if (!callbackParamName) callbackParamName = 'callback';
    queryParams += '&' + callbackParamName + '=' + name;

    // Create script element
    let script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = endpoint + '?' + queryParams;

    // Setup handler
    window[name] = function(data) {
      callback.call(window, data);

      // Clean up
      script.remove();
      script = null;
      delete window[name];
    };

    // Load JSON
    document.getElementsByTagName('head')[0].appendChild(script);
  };
})();
<commit_msg>Also escape "+" in loadJsonp()<commit_after>'use strict';

// Library function to load JSONP data
// Adapted from https://gist.github.com/gf3/132080/110d1b68d7328d7bfe7e36617f7df85679a08968

var loadJsonp = (function(){
  var unique = 0;
  return function(endpoint, params, callback, callbackParamName) {

    // Create unique function name
    let name = '_jsonp_' + unique++;

    // Construct URL
    let queryParams = Object.keys(params).map(function(el) {
      return escape(el) + '=' + escape(params[el]).replace(/\+/, '%2B');
    }).join('&');
    queryParams += queryParams ? '&' : '';
    if (!callbackParamName) callbackParamName = 'callback';
    queryParams += '&' + callbackParamName + '=' + name;

    // Create script element
    let script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = endpoint + '?' + queryParams;

    // Setup handler
    window[name] = function(data) {
      callback.call(window, data);

      // Clean up
      script.remove();
      script = null;
      delete window[name];
    };

    // Load JSON
    document.getElementsByTagName('head')[0].appendChild(script);
  };
})();

{'fraction_non_alphanumeric': 0.1557305336832896, 'fraction_numerical': 0.03280839895013123, 'mean_word_length': 3.173357664233577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3464217', 'n_tokens_mistral': 751, 'n_tokens_neox': 697, 'n_words': 154}