<commit_before>export const SELECTED_PLAYER = 1;
export const SELECTED_PLAYER_PET = 2;
const VALID_BY_FLAGS = SELECTED_PLAYER | SELECTED_PLAYER_PET;

class EventFilter {
  eventType;
  constructor(eventType) {
    this.eventType = eventType;
  }
  _by;
  /**
   * @param {number} value
   * @returns {EventFilter}
   */
  by(value) {
    if (value === undefined) {
      return this._by;
    }
    if (!this.constructor.validateBy(value)) {
      throw new Error(`by filter not recognized: ${value}`);
    }
    this._by = value;
    return this;
  }
  static validateBy(value) {
    return (value & VALID_BY_FLAGS) === value;
  }
  _to;
  /**
   * @param {number} value
   * @returns {EventFilter}
   */
  to(value) {
    if (value === undefined) {
      return this._to;
    }
    this._to = value;
    return this;
  }
  _spell;
  /**
   * @param {object} value
   * @returns {EventFilter}
   */
  spell(value) {
    if (value === undefined) {
      return this._spell;
    } else if (typeof value !== 'object') {
      throw new Error('The spell filter must be a spell object, not a spell id.');
    }
    this._spell = value;
    return this;
  }
}

export default EventFilter;<commit_msg>Add TODOs<commit_after>export const SELECTED_PLAYER = 1;
export const SELECTED_PLAYER_PET = 2;
const VALID_BY_FLAGS = SELECTED_PLAYER | SELECTED_PLAYER_PET;

class EventFilter {
  eventType;
  constructor(eventType) {
    this.eventType = eventType;
  }
  _by;
  /**
   * @param {number} value
   * @returns {EventFilter}
   */
  by(value) {
    if (value === undefined) {
      return this._by;
    }
    if (!this.constructor.validateBy(value)) {
      throw new Error(`by filter not recognized: ${value}`);
    }
    this._by = value;
    return this;
  }
  static validateBy(value) {
    return (value & VALID_BY_FLAGS) === value;
  }
  _to;
  /**
   * @param {number} value
   * @returns {EventFilter}
   */
  to(value) {
    // TODO: Allow `this.selectedCombatant` (i.e. instances of Combatant) as value instead
    if (value === undefined) {
      return this._to;
    }
    this._to = value;
    return this;
  }
  _spell;
  /**
   * @param {object} value
   * @returns {EventFilter}
   */
  spell(value) {
    // TODO: Use spell id instead
    if (value === undefined) {
      return this._spell;
    } else if (typeof value !== 'object') {
      throw new Error('The spell filter must be a spell object, not a spell id.');
    }
    this._spell = value;
    return this;
  }
}

export default EventFilter;
{'fraction_non_alphanumeric': 0.13192506974890394, 'fraction_numerical': 0.0015942606616181746, 'mean_word_length': 2.6482558139534884, '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': '1339256', 'n_tokens_mistral': 858, 'n_tokens_neox': 851, 'n_words': 221}