<commit_before><commit_msg>library js - <NAME><commit_after>var _ = {
   map: function(arr, callback) {
     var newarr = [];
     for(var i = 0; i < arr.length; i++){
       newarr.push(callback(arr[i]));
     }
     return newarr;
   },
   reduce: function(arr, callback) {
     var value = 0;
     for(var i = 0; i < arr.length; i++){
       value += callback(arr[i]);
     }
     return value;
   },
   find: function(arr, callback) {
     var value;
     for(var i = 0; i < arr.length; i++){
       if(callback(arr[i])){
         return value = arr[i];
       }
     }
   },
   filter: function(arr, callback) {
     var newarr = [];
     for(var i = 0; i < arr.length; i++){
       if(callback(arr[i])){
         newarr.push(arr[i]);
       }
    }
     return newarr;
   },
   reject: function(arr, callback) {
     var newarr = [];
     for(var i = 0; i < arr.length; i++){
       if(callback(arr[i])){
         newarr.push(arr[i]);
     }
     }
    return newarr;
  }
}
// you just created a library with 5 methods!

var evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
console.log(evens);

var maps = _.map([1, 2, 3, 4, 5, 6], function(num){ return num * 2; });
console.log(maps);

var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 1; });
console.log(odds);

var reduction = _.reduce([1, 2, 3, 4, 5, 6], function(num){ return num; });
console.log(reduction); //HELP! this works but I know I cut a corner

var finder = _.find([1, 2, 3, 4, 5, 6], function(num){ return num % 4 == 0; });
console.log(finder);

{'fraction_non_alphanumeric': 0.19196428571428573, 'fraction_numerical': 0.02806122448979592, 'mean_word_length': 2.4483516483516485, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 4, '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': '5091657', 'n_tokens_mistral': 606, 'n_tokens_neox': 563, 'n_words': 163}