<commit_before>export default class Subscriber {
  constructor (disposeHandler) {
    this.disposeHandler = disposeHandler
    this.emitHandlers = []
    this.errorHandlers = []
  }

  subscribe (forEmit, forError) {
    if (forEmit) {
      this.emitHandlers.push(forEmit)
    }
    if (forError) {
      this.errorHandlers.push(forError)
    }
    return this
  }

  emit (err, payload) {
    if (err) {
      this.errorHandlers.map(cb => cb(err))
    }
    if (payload) {
      this.emitHandlers.map(cb => cb(payload))
    }
    return this
  }

  dispose () {
    this.disposeHandler()
    delete this.emitHandlers
    delete this.errorHandlers
    return this
  }
}<commit_msg>fix subscriber class to have privates and use function<commit_after>export default function Subscriber (disposeHandler) {
  const emitHandlers = []
  const errorHandlers = []

  this.subscribe = (forEmit, forError) => {
    if (forEmit) {
      emitHandlers.push(forEmit)
    }
    if (forError) {
      errorHandlers.push(forError)
    }
    return this
  }

  this.emit = (err, payload) => {
    if (err) {
      errorHandlers.map(cb => cb(err))
    }
    if (payload) {
      emitHandlers.map(cb => cb(payload))
    }
    return this
  }

  this.dispose = () => {
    disposeHandler()
    emitHandlers.splice(0)
    errorHandlers.splice(0)
    return this
  }
}
{'fraction_non_alphanumeric': 0.11961367013372957, 'fraction_numerical': 0.0014858841010401188, 'mean_word_length': 2.5824468085106385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '4394604', 'n_tokens_mistral': 462, 'n_tokens_neox': 457, 'n_words': 89}