<commit_before>/* Execute automatically when the script is loaded to add
 * all the new datatypes to the window object for easy 
 * use */

/* Lists are easy to use arrays with helpful functions
 * for working with all of the elements in the array */
window.List = (function(){
    "use strict";

    /* Constructor funcion, which creates a copy of the 
     * array prototype, then injects the custom functions
     * into the new prototype */
    function List(){
        var list = Object.create(Array.prototype);
        list = Array.apply(list, arguments);
        List.injectPrototypeMethods(list);
        return list;
    }
    
    /* Injects the defined prototype methods into the new
     * class */
    List.injectPrototypeMethods = function(list){
      for(var method in List.prototype){
        if(List.prototype.hasOwnProperty(method)){
          list[method] = List.prototype[method];
        }
      }
      return list;
    };
    
    /* Define all the prototype functions */
    List.prototype = {

        /* Execute a function on each of the elements in
         * the, and if the function returns a value, set
         * the value of the element to the returned value
         * in place */
        each: function(callback){
            for(var i=0; i<this.length; i++){
                var temp = callback(this[i], i);
                if(temp !== undefined) this[i] = temp;
            }
        }
    };

    return List;
})();

/* Dictionaries are objects with extended prototypes for
 * ease of use, particulary when iterating over them */
window.Dictionary = (function(){
    "use strict";
    
    /* Constructor which creates a copy of the Object 
     * prototype and then injects the custom defined
     * functions into the new object's prototype */
    function Dictionary(base){
        var dictionary = Object.create(Dictionary.prototype);
        if(base !== undefined){
            for(var prop in base){
                if(base.hasOwnProperty(prop)){
                    dictionary[prop] = base[prop];
                }
            }
        }
        return dictionary;
    }

    /* All of the dictionaries prototype functions */
    Dictionary.prototype = {
        
        /* Returns all the keys in the object as an array */
        keys: function(){
            var keys = [];
            for(var prop in this){
                if(!Dictionary.prototype.hasOwnProperty(prop)){
                    keys.push(prop);
                }
            }
            return keys;
        },

        /* iterates over all the key: value pairs in the object
         * and executes a callback on them, passing the key, 
         * the value and the index to the function. If the 
         * callback returns a value, update the value of the 
         * pair */
        each: function(callback){
            var keys = this.keys();
            for(var i=0; i<keys.length; i++){
                var temp = callback(keys[i], this[keys[i]], i);
                if(temp !== undefined) this[keys[i]] = temp;
            }
        },

        /* Returns whether or not the dictionary contains a
         * specified key */
        hasKey: function(key){
            if(this[key] !== undefined) return false;
            else return true;
        },

        /* Removes an item from the dictionary */
        delete: function(key){
            delete this[key];
        }
    };
    
    return Dictionary;
})();
<commit_msg>Added List.remove(index)<commit_after>/* Execute automatically when the script is loaded to add
 * all the new datatypes to the window object for easy 
 * use */

/* Lists are easy to use arrays with helpful functions
 * for working with all of the elements in the array */
window.List = (function(){
    "use strict";

    /* Constructor funcion, which creates a copy of the 
     * array prototype, then injects the custom functions
     * into the new prototype */
    function List(){
        var list = Object.create(Array.prototype);
        list = Array.apply(list, arguments);
        List.injectPrototypeMethods(list);
        return list;
    }
    
    /* Injects the defined prototype methods into the new
     * class */
    List.injectPrototypeMethods = function(list){
      for(var method in List.prototype){
        if(List.prototype.hasOwnProperty(method)){
          list[method] = List.prototype[method];
        }
      }
      return list;
    };
    
    /* Define all the prototype functions */
    List.prototype = {

        /* Execute a function on each of the elements in
         * the, and if the function returns a value, set
         * the value of the element to the returned value
         * in place */
        each: function(callback){
            for(var i=0; i<this.length; i++){
                var temp = callback(this[i], i);
                if(temp !== undefined) this[i] = temp;
            }
        },

        /* Removes an element from the array at the specified
         * index */
        remove: function(index){
            this.splice(index, 1);
        }
    };

    return List;
})();

/* Dictionaries are objects with extended prototypes for
 * ease of use, particulary when iterating over them */
window.Dictionary = (function(){
    "use strict";
    
    /* Constructor which creates a copy of the Object 
     * prototype and then injects the custom defined
     * functions into the new object's prototype */
    function Dictionary(base){
        var dictionary = Object.create(Dictionary.prototype);
        if(base !== undefined){
            for(var prop in base){
                if(base.hasOwnProperty(prop)){
                    dictionary[prop] = base[prop];
                }
            }
        }
        return dictionary;
    }

    /* All of the dictionaries prototype functions */
    Dictionary.prototype = {
        
        /* Returns all the keys in the object as an array */
        keys: function(){
            var keys = [];
            for(var prop in this){
                if(!Dictionary.prototype.hasOwnProperty(prop)){
                    keys.push(prop);
                }
            }
            return keys;
        },

        /* iterates over all the key: value pairs in the object
         * and executes a callback on them, passing the key, 
         * the value and the index to the function. If the 
         * callback returns a value, update the value of the 
         * pair */
        each: function(callback){
            var keys = this.keys();
            for(var i=0; i<keys.length; i++){
                var temp = callback(keys[i], this[keys[i]], i);
                if(temp !== undefined) this[keys[i]] = temp;
            }
        },

        /* Returns whether or not the dictionary contains a
         * specified key */
        hasKey: function(key){
            if(this[key] !== undefined) return false;
            else return true;
        },

        /* Removes an item from the dictionary */
        delete: function(key){
            delete this[key];
        }
    };
    
    return Dictionary;
})();

{'fraction_non_alphanumeric': 0.0973576374169846, 'fraction_numerical': 0.0007065140596297867, 'mean_word_length': 1.7800471327572662, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3537365', 'n_tokens_mistral': 1797, 'n_tokens_neox': 1747, 'n_words': 651}