<commit_before>var events = require('./events.json');
var _ = require('lodash');

function answer(){
    console.log(events.length);
    return {
        'total': events.length,
        'PushEvent':{
            'total': foo("PushEvent").length
        }
    }
}

function foo(eventType){
        return _.filter(events, {'type':eventType});
    }



//var pushEvents = _.filter(events, {'type':'PushEvent'})
console.log(answer());
//console.log(answer());

//function answer(){
//  return {
//    'total': ...,    // How many total events did you fetch?
//    'PushEvent': {
//      'total': ...,  // How many total events of type `PushEvent` are there?
//      'perDay': ...  // On average, how many`PushEvent` entries per day?
//    },
//    'other': {
//      'total': ...,  // How many _other_ events are in the data?
//      'perDay': ...  // How many per day, on average?
//    }
//  };
//} // END answer<commit_msg>made a function to subtract number of days on PushEvents, refactoring to just all days total<commit_after>var events = require('./events.json');
var _ = require('lodash');

function eventSearch(eventType){
        return _.filter(events, {'type':eventType});
    }
function getDate (eventType){
    return _.pluck(_.filter(eventSearch(eventType)), 'created_at')
};
var pushEventDates = getDate("PushEvent");

function dateDiff(){
    return _.first(getDate) - _.last(getDate);
}



function answer(){
    return {
        'total': events.length,
        'PushEvent':{
            'total': eventSearch("PushEvent").length,
            'perDay': _.first(pushEventDates).substring(8, 10) - _.last(pushEventDates).substring(8, 10)
        }
    }
}

console.log(pushEventDates);
console.log(answer());
//console.log(answer());

//function answer(){
//  return {
//    'total': ...,    // How many total events did you fetch?
//    'PushEvent': {
//      'total': ...,  // How many total events of type `PushEvent` are there?
//      'perDay': ...  // On average, how many`PushEvent` entries per day?
//    },
//    'other': {
//      'total': ...,  // How many _other_ events are in the data?
//      'perDay': ...  // How many per day, on average?
//    }
//  };
//} // END answer
{'fraction_non_alphanumeric': 0.18954545454545454, 'fraction_numerical': 0.0027272727272727275, 'mean_word_length': 2.460691823899371, 'pattern_counts': {'":': 0, '<': 3, '<?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': '472538', 'n_tokens_mistral': 693, 'n_tokens_neox': 673, 'n_words': 177}