<commit_before>/**
 * Returns whether or not a value is a string.
 * @param str - The tested value.
 * @return whether or not a value is a string.
 */
function isString(str) {
  return typeof str === "string" ||
                str instanceof String;
};

/**
 * Returns whether or not a value is a regexp.
 * @param rexp - The tested value.
 * @return whether or not a value is a regexp.
 */
function isRegExp(rexp) {
  return rexp instanceof RegExp;
}

/**
 * Returns whether or not a value is a function.
 * @param func - The tested value.
 * @return whether or not a value is a function.
 */
function isFunction(func) {
  return func instanceof Function;
}

/**
 * Returns whether or not a value is an array.
 * @param arr - The tested value.
 * @return whether or not a value is an array.
 */
var isArray = Array.isArray || function(arr) {
  return arr instanceof Array;
};

/**
 * Returns an array copy of the given iterable.
 * @param iter - The given iterable.
 * @return an array copy of the given iterable.
 */
var new$Array = Array.from || function(iter) {
  return Array.prototype.slice.call( iter, 0 );
}

// String-specific functions
var $String = {

  /**
   * Returns a random hash containing [0-9a-z] characters.
   * @return a random hash containing [0-9a-z] characters.
   */
  random: function() {
    return Math.random().toString(36).replace(/0\./, "");
  }
  
};

// Array-specific ECMAv5-inspired functions
var $Array = {

  /**
   * Iterates over the given array calling the given
   * callback function at each defined cell with the
   * following parameters:
   *
   *   value, index, array
   *
   * @param arr - The given array.
   * @param callback - The given callback function.
   */
  forEach: "forEach" in Array.prototype
    ? function(arr, callback) {
        arr.forEach( callback );
      }
    : function(arr, callback) {
      for(var i = 0; i < arr.length; i++) {
        if( arr[i] !== undefined )
          callback( arr[i], i, arr );
      }
    },
  
  /**
   * Iterates over the given array calling the given
   * callback function at each defined cell with the
   * following parameters:
   *
   *   value, index, array
   *
   * If the callback function returns true, the some
   * function stops iterating and immediately returns
   * true. If the end of the array is reached without
   * the callback function returning true, the some
   * function returns false.
   *
   * @param arr - The given array.
   * @param callback - The given callback function.
   * @return whether the predicate of the given callback
   *         function holds for at least one element
   *         of the given array.
   */
  some: "some" in Array.prototype
    ? function(arr, callback) {
        return arr.some( callback );
      }
    : function(arr, callback) {
      for(var i = 0; i < arr.length; i++) {
        if( arr[i] !== undefined ) {
          if( callback( arr[i], i, arr ) ) {
            return true;
          }
        }
      } return false;
    },

  /**
   * Returns the index at which the given array contains the
   * given value. If the array doesn't contain the given value,
   * -1 is returned instead.
   *
   * @param arr - The given array.
   * @param val - The given value.
   * @return the index at which the given array contains the
   *         given value.
   */
  indexOf: "indexOf" in Array.prototype
    ? function(arr, val) {
        return arr.indexOf( val );
      }
    : function(arr, val) {
      for(var i = 0; i < arr.length; i++) {
        if( arr[i] == val ) {
          return i;
        }
      } return -1;
    },
    
  /**
   * Returns whether the given array contains the given value.
   *
   * @param arr - The given array.
   * @param val - The given value.
   * @return whether the given array contains the given value.
   */
  contains: function(arr, val) {
    return $Array.indexOf( arr, val ) !== -1;
  },
  <commit_msg>sparse array support<commit_after>/**
 * Returns whether or not a value is a string.
 * @param str - The tested value.
 * @return whether or not a value is a string.
 */
function isString(str) {
  return typeof str === "string" ||
                str instanceof String;
};

/**
 * Returns whether or not a value is a regexp.
 * @param rexp - The tested value.
 * @return whether or not a value is a regexp.
 */
function isRegExp(rexp) {
  return rexp instanceof RegExp;
}

/**
 * Returns whether or not a value is a function.
 * @param func - The tested value.
 * @return whether or not a value is a function.
 */
function isFunction(func) {
  return func instanceof Function;
}

/**
 * Returns whether or not a value is an array.
 * @param arr - The tested value.
 * @return whether or not a value is an array.
 */
var isArray = Array.isArray || function(arr) {
  return arr instanceof Array;
};

/**
 * Returns an array copy of the given iterable.
 * @param iter - The given iterable.
 * @return an array copy of the given iterable.
 */
var new$Array = Array.from || function(iter) {
  return Array.prototype.slice.call( iter, 0 );
}

// String-specific functions
var $String = {

  /**
   * Returns a random hash containing [0-9a-z] characters.
   * @return a random hash containing [0-9a-z] characters.
   */
  random: function() {
    return Math.random().toString(36).replace(/0\./, "");
  }
  
};

// Array-specific ECMAv5-inspired functions
var $Array = {

  /**
   * Iterates over the given array calling the given
   * callback function at each defined cell with the
   * following parameters:
   *
   *   value, index, array
   *
   * @param arr - The given array.
   * @param callback - The given callback function.
   */
  forEach: "forEach" in Array.prototype
    ? function(arr, callback) {
        arr.forEach( callback );
      }
    : function(arr, callback) {
      for(var i = 0; i < arr.length; i++) {
        if( i in arr ) {
          callback( arr[i], i, arr );
        }
      }
    },
  
  /**
   * Iterates over the given array calling the given
   * callback function at each defined cell with the
   * following parameters:
   *
   *   value, index, array
   *
   * If the callback function returns true, the some
   * function stops iterating and immediately returns
   * true. If the end of the array is reached without
   * the callback function returning true, the some
   * function returns false.
   *
   * @param arr - The given array.
   * @param callback - The given callback function.
   * @return whether the predicate of the given callback
   *         function holds for at least one element
   *         of the given array.
   */
  some: "some" in Array.prototype
    ? function(arr, callback) {
        return arr.some( callback );
      }
    : function(arr, callback) {
      for(var i = 0; i < arr.length; i++) {
        if( i in arr ) {
          if( callback( arr[i], i, arr ) ) {
            return true;
          }
        }
      } return false;
    },

  /**
   * Returns the index at which the given array contains the
   * given value. If the array doesn't contain the given value,
   * -1 is returned instead.
   *
   * @param arr - The given array.
   * @param val - The given value.
   * @return the index at which the given array contains the
   *         given value.
   */
  indexOf: "indexOf" in Array.prototype
    ? function(arr, val) {
        return arr.indexOf( val );
      }
    : function(arr, val) {
      for(var i = 0; i < arr.length; i++) {
        if( arr[i] === val ) {
          return i;
        }
      } return -1;
    },
    
  /**
   * Returns whether the given array contains the given value.
   *
   * @param arr - The given array.
   * @param val - The given value.
   * @return whether the given array contains the given value.
   */
  contains: function(arr, val) {
    return $Array.indexOf( arr, val ) !== -1;
  },
  
{'fraction_non_alphanumeric': 0.11166538756715272, 'fraction_numerical': 0.003837298541826554, 'mean_word_length': 2.26744671959883, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1498676', 'n_tokens_mistral': 2320, 'n_tokens_neox': 2293, 'n_words': 910}