<commit_before>import TransactionTypes from '../constants/TransactionTypes';

const validTypes = Object.values(TransactionTypes);

class Transaction {
  constructor(path, value, type = TransactionTypes.SET) {
    if (!validTypes.includes(type)) {
      throw new TypeError(`Only the following types are allowed: ${validTypes}`);
    }
    Object.defineProperties(this, {
      path: {
        value: path,
        writable: false
      },
      value: {
        value,
        writable: false
      },
      type: {
        value: type,
        writable: false
      }
    });
  }

}

module.exports = Transaction;<commit_msg>Change error message in Transction constructor<commit_after>import TransactionTypes from '../constants/TransactionTypes';

const validTypes = Object.values(TransactionTypes);
const validKeys = Object.keys(TransactionTypes);

class Transaction {
  constructor(path, value, type = TransactionTypes.SET) {
    if (!validTypes.includes(type)) {
      throw new TypeError(`Only the following types are allowed: ${validKeys}`);
    }
    Object.defineProperties(this, {
      path: {
        value: path,
        writable: false
      },
      value: {
        value,
        writable: false
      },
      type: {
        value: type,
        writable: false
      }
    });
  }
}

module.exports = Transaction;
{'fraction_non_alphanumeric': 0.11036036036036036, 'fraction_numerical': 0.0, 'mean_word_length': 2.6027027027027025, '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': '336115', 'n_tokens_mistral': 360, 'n_tokens_neox': 362, 'n_words': 89}