<commit_before>"use strict";

angular.module('arethusa').service('history', function(state, configurator) {
  this.conf = configurator.configurationFor('history');
  this.template = this.conf.template;
  this.maxSize = this.conf.maxSize || 20;
  /* global HistoryObj */
  this.history = new HistoryObj(this.maxSize);
  this.save = function(event) {
    this.history.unshift(event);
  };

  this.save(state.tokens); // hold the intial state
});<commit_msg>Simple update of history service<commit_after>"use strict";

angular.module('arethusa').service('history', function(state, configurator) {
  this.conf = configurator.configurationFor('history');
  this.template = this.conf.template;
  this.maxSize = this.conf.maxSize || 20;

  /* global HistoryObj */
  this.history = new HistoryObj(this.maxSize);
  this.position = 0;

  this.save = function(target, property, oldVal, newVal) {
    this.history.unshift([target, property, oldVal, newVal]);
  };

  this.undo = function() {
    var hist = this.history.elements.shift();
    var obj  = hist[0];
    obj[hist[1]] = hist[2];
  };
});
{'fraction_non_alphanumeric': 0.16022099447513813, 'fraction_numerical': 0.007366482504604052, 'mean_word_length': 4.328431372549019, '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': '1044139', 'n_tokens_mistral': 354, 'n_tokens_neox': 342, 'n_words': 67}