<commit_before>'use strict';

export default class Events {
  constructor() { this._events = {}; }

  trigger(label, ...rest) {
    if (!this._events[label]) return;

    for (let func in this._events[label]) {
      this._events[label][func].apply(null, rest);
    }
  }

  register(label, fct) {
    if (!this._events[label]) this._events[label] = [];

    this._events[label].push(fct);
  }

  unregister(label, fct) {
    this._events[label].splice(this._events[label].indexOf(fct), 1);
  }

  /**
   *
   * COMMON SUBSCRIBE AND UNSUBSCRIBE ALIASES
   *
   */
  subscribe() { return this.register.apply(this, arguments); }
  unsubscribe() { return this.unregister.apply(this, arguments); }
  on() { return this.register.apply(this, arguments); }
  off() { return this.unregister.apply(this, arguments); }
  listen() { return this.register.apply(this, arguments); }
  unlisten() { return this.unregister.apply(this, arguments); }

  /**
   *
   * COMMON PUBLISH ALIASES
   */
  emit() { return this.trigger.apply(this, arguments); }
}<commit_msg>add publish alias<commit_after>'use strict';

export default class Events {
  constructor() { this._events = {}; }

  trigger(label, ...rest) {
    if (!this._events[label]) return;

    for (let func in this._events[label]) {
      this._events[label][func].apply(null, rest);
    }
  }

  register(label, fct) {
    if (!this._events[label]) this._events[label] = [];

    this._events[label].push(fct);
  }

  unregister(label, fct) {
    this._events[label].splice(this._events[label].indexOf(fct), 1);
  }

  /**
   *
   * COMMON SUBSCRIBE AND UNSUBSCRIBE ALIASES
   *
   */
  subscribe() { return this.register.apply(this, arguments); }
  unsubscribe() { return this.unregister.apply(this, arguments); }

  on() { return this.register.apply(this, arguments); }
  off() { return this.unregister.apply(this, arguments); }

  listen() { return this.register.apply(this, arguments); }
  unlisten() { return this.unregister.apply(this, arguments); }

  /**
   *
   * COMMON PUBLISH ALIASES
   */
  emit() { return this.trigger.apply(this, arguments); }
  publish() { return this.trigger.apply(this, arguments); }
}
{'fraction_non_alphanumeric': 0.16913123844731978, 'fraction_numerical': 0.0009242144177449168, 'mean_word_length': 3.5771670190274842, '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': '7204817', 'n_tokens_mistral': 734, 'n_tokens_neox': 716, 'n_words': 138}