<commit_before>// Backbone.NativeAjax.js 0.2.0
// ---------------

//     (c) 2014 <NAME>, <NAME>, Exoskeleton Project
//     Backbone.NativeAjax may be freely distributed under the MIT license.
//     For all details and documentation:
//     https://github.com/akre54/Backbone.NativeAjax

(function (factory) {
  if (typeof define === 'function' && define.amd) { define(['backbone'], factory);
  } else if (typeof exports === 'object') { factory(require('backbone'));
  } else { factory(Backbone); }
}(function (Backbone) {
  // Make an AJAX request to the server.
  // Usage:
  //   var req = Backbone.ajax({url: 'url', type: 'PATCH', data: 'data'});
  //   req.done(...).error(...) // if Backbone.Deferred is set
  Backbone.ajax = (function() {
    var xmlRe = /^(?:application|text)\/xml/;
    var jsonRe = /^application\/json/;

    var getData = function(accepts, xhr) {
      if (accepts == null) accepts = xhr.getResponseHeader('content-type');
      if (xmlRe.test(accepts)) {
        return xhr.responseXML;
      } else if (jsonRe.test(accepts)) {
        return JSON.parse(xhr.responseText);
      } else {
        return xhr.responseText;
      }
    };
<commit_msg>Don't try to parse empty response<commit_after>// Backbone.NativeAjax.js 0.2.0
// ---------------

//     (c) 2014 <NAME>, <NAME>, Exoskeleton Project
//     Backbone.NativeAjax may be freely distributed under the MIT license.
//     For all details and documentation:
//     https://github.com/akre54/Backbone.NativeAjax

(function (factory) {
  if (typeof define === 'function' && define.amd) { define(['backbone'], factory);
  } else if (typeof exports === 'object') { factory(require('backbone'));
  } else { factory(Backbone); }
}(function (Backbone) {
  // Make an AJAX request to the server.
  // Usage:
  //   var req = Backbone.ajax({url: 'url', type: 'PATCH', data: 'data'});
  //   req.done(...).error(...) // if Backbone.Deferred is set
  Backbone.ajax = (function() {
    var xmlRe = /^(?:application|text)\/xml/;
    var jsonRe = /^application\/json/;

    var getData = function(accepts, xhr) {
      if (accepts == null) accepts = xhr.getResponseHeader('content-type');
      if (xmlRe.test(accepts)) {
        return xhr.responseXML;
      } else if (jsonRe.test(accepts) && xhr.responseText !== '') {
        return JSON.parse(xhr.responseText);
      } else {
        return xhr.responseText;
      }
    };

{'fraction_non_alphanumeric': 0.18155380141254673, 'fraction_numerical': 0.007478188616535106, 'mean_word_length': 2.7217928902627513, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '5179164', 'n_tokens_mistral': 788, 'n_tokens_neox': 766, 'n_words': 192}