<commit_before>var _     = require('lodash');

    var mapTimestamp = function(obj) {
        return obj.timestamp;
    };

    var reduceToSameDay = function(timestamps) {
        return _.groupBy(timestamps, function(timestamp) {
            return timestamp.split('T')[0];
        });
    }
var getCommitsPerDay = function(_commitsCollection, _provider) {

    commitsPerDay = _commitsCollection.mapReduce(mapTimestamp, reduceToSameDay);
    return _.map(commitsPerDay, function(item, key) {
        return {'date': key, 'num_commits': item.length};
    });
}

module.exports = {
    getCommitsPerDay: getCommitsPerDay
}
<commit_msg>get rid of the loki map reduce function<commit_after>var _     = require('lodash');

var getCommitsPerDay = function(_commitsCollection, _provider) {
    var commitsForProvider = _commitsCollection.where(function(item) {
        return item.provider === _provider;
    });

    var commitsPerDay = _.chain(commitsForProvider).map(function(item) {
        return item.timestamp;
    }).groupBy(function(item) {
        return item.split('T')[0];
    }).map(function(item, key) {
        return {'date': key, 'num_commits': item.length};
    }).value();

    return commitsPerDay;
}

module.exports = {
    getCommitsPerDay: getCommitsPerDay
}

{'fraction_non_alphanumeric': 0.12754303599374023, 'fraction_numerical': 0.001564945226917058, 'mean_word_length': 3.5035211267605635, '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': '6019598', 'n_tokens_mistral': 399, 'n_tokens_neox': 388, 'n_words': 74}