<commit_before>(function() {
  'use strict';

  /**
   * Helper methods for use in tests
   */
  global.helper = {
    forEachMethod: forEachMethod,
    matchesJSON: matchesJSON
  };

  /**
   * Invokes the given function for each {@link Ono} method
   *
   * @param {function} fn - The function that's invoked for each method
   */
  function forEachMethod(fn) {
    var names = ['', 'error', 'eval', 'range', 'reference', 'syntax', 'type', 'uri'];
    var types = ['Error', 'Error', 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError'];

    for (var i = 0; i < names.length; i++) {
      var name, method;

      if (i === 0) {
        name = 'ono()';
        method = ono;
      }
      else {
        name = 'ono.' + names[i] + '()';
        method = ono[names[i]];
      }

      var type = types[i];
      fn(name, method, global[type], type);
    }
  }

  /**
   * Asserts that a JSON-serialized Error has the expected properties & values.
   *
   * @param {object} expected - The expected properties & values
   * @returns {function}
   */
  function matchesJSON(expected) {
    return function(json) {
      if (userAgent.isFirefox) {
        expect(json.fileName).to.be.a('string').and.not.empty;
        expect(json.lineNumber).to.be.a('number').above(0);
        expect(json.columnNumber).to.be.a('number').above(0);
        expected.fileName = json.fileName;
        expected.lineNumber = json.lineNumber;
        expected.columnNumber = json.columnNumber;
      }

      if (userAgent.isSafari) {
        expect(json.sourceURL).to.be.a('string').and.not.empty;
        expect(json.line).to.be.a('number').above(0);
        expect(json.column).to.be.a('number').above(0);
        expected.sourceURL = json.sourceURL;
        expected.line = json.line;
        expected.column = json.column;
      }

      if (userAgent.isIE && 'description' in json) {
        expect(json.description).to.be.a('string');
        expected.description = json.description;
      }

      if (!('stack' in json)) {
        // Some browsers don't support the "stack" property
        delete expected.stack;
      }

      expect(json).to.deep.equal(expected);
      return true;
    }
  }
})();
<commit_msg>Fixed some broken tests on Safari<commit_after>(function() {
  'use strict';

  /**
   * Helper methods for use in tests
   */
  global.helper = {
    forEachMethod: forEachMethod,
    matchesJSON: matchesJSON
  };

  /**
   * Invokes the given function for each {@link Ono} method
   *
   * @param {function} fn - The function that's invoked for each method
   */
  function forEachMethod(fn) {
    var names = ['', 'error', 'eval', 'range', 'reference', 'syntax', 'type', 'uri'];
    var types = ['Error', 'Error', 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError'];

    for (var i = 0; i < names.length; i++) {
      var name, method;

      if (i === 0) {
        name = 'ono()';
        method = ono;
      }
      else {
        name = 'ono.' + names[i] + '()';
        method = ono[names[i]];
      }

      var type = types[i];
      fn(name, method, global[type], type);
    }
  }

  /**
   * Asserts that a JSON-serialized Error has the expected properties & values.
   *
   * @param {object} expected - The expected properties & values
   * @returns {function}
   */
  function matchesJSON(expected) {
    return function(json) {
      if (userAgent.isFirefox) {
        expect(json.fileName).to.be.a('string').and.not.empty;
        expect(json.lineNumber).to.be.a('number').above(0);
        expect(json.columnNumber).to.be.a('number').above(0);
        expected.fileName = json.fileName;
        expected.lineNumber = json.lineNumber;
        expected.columnNumber = json.columnNumber;
      }

      // Only recent versions of Safari include these properties
      if (userAgent.isSafari && json.sourceURL) {
        expect(json.sourceURL).to.be.a('string').and.not.empty;
        expect(json.line).to.be.a('number').above(0);
        expect(json.column).to.be.a('number').above(0);
        expected.sourceURL = json.sourceURL;
        expected.line = json.line;
        expected.column = json.column;
      }

      if (userAgent.isIE && 'description' in json) {
        expect(json.description).to.be.a('string');
        expected.description = json.description;
      }

      if (!('stack' in json)) {
        // Some browsers don't support the "stack" property
        delete expected.stack;
      }

      expect(json).to.deep.equal(expected);
      return true;
    }
  }
})();

{'fraction_non_alphanumeric': 0.15830961243704839, 'fraction_numerical': 0.0026275454346398074, 'mean_word_length': 2.444947209653092, 'pattern_counts': {'":': 0, '<': 5, '<?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': '780553', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1409, 'n_words': 320}