<commit_before>var debug = require('debug')('rms:eventstore'),
	_ = require('lodash');

var AggRoot = function(when) {
	var eventhandlers = when;

	this.handle = function(events) {
		debug('', 'Handling Events: ' + JSON.stringify(events));
		var self = this;
		if (events.length > 0) {
			_.each(events, function(ev) {
				if (eventhandlers[ev.eventType] !== undefined) {
					eventhandlers[ev.eventType].call(self, ev);
					if (ev.eventNumber) {
						self._version = ev.eventNumber;
					}
				}
			});
		}
	};
};

module.exports = AggRoot;<commit_msg>[Fix] version of aggregrate not setting on event 0<commit_after>var debug = require('debug')('geteventstore:aggRoot'),
	_ = require('lodash');

var AggRoot = function(when) {
	var eventhandlers = when;

	this.handle = function(events) {
		debug('', 'Handling Events: ' + JSON.stringify(events));
		var self = this;
		if (events.length > 0) {
			_.each(events, function(ev) {
				if (eventhandlers[ev.eventType] !== undefined) {
					eventhandlers[ev.eventType].call(self, ev);
					if (ev.eventNumber !== undefined) {
						self._version = ev.eventNumber;
					}
				}
			});
		}
	};
};

module.exports = AggRoot;
{'fraction_non_alphanumeric': 0.16695205479452055, 'fraction_numerical': 0.0025684931506849314, 'mean_word_length': 3.6573705179282867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1391289', 'n_tokens_mistral': 472, 'n_tokens_neox': 394, 'n_words': 78}