<commit_before>'use strict'
var isEmpty = require('../../util/is/empty')

module.exports = function triggerInternal (event) {
  var binds = this.binds && this.binds[event.stamp]

  if (binds) {
    for (let i in binds) {
      let bound = binds[i]
      let data = bound.data
      let bind = bound.val

      if (bound.context) {
        execContext.call(this, bound, event, data)
        bound.context[0].bind.setContextChain(bound.context)
      }

      if (bind) {
        bind.clearContextUp()
        this.execInternal(bind, event, data)
        // removal is too fast for condition!
      }

      delete binds[i]
    }

    if (isEmpty(binds)) {
      delete this.binds
    }
  }
}

function execContext (bound, event, data) {
  for (let j in bound) {
    // this needs cleaning of course (check char range index)
    if (j !== 'data' && j !== 'val' && j !== 'context' && j !== 'chain') {
      if (bound[j].chain) {
        let bind = this.setContextChain(bound[j].chain)
        this.execInternal(bind, event, data)<commit_msg>cleanup<commit_after>'use strict'
var isEmpty = require('../../util/is/empty')
var isNumberLike = require('../../util/is/numberlike')

module.exports = function triggerInternal (event) {
  var binds = this.binds && this.binds[event.stamp]

  if (binds) {
    for (let i in binds) {
      let bound = binds[i]
      let data = bound.data
      let bind = bound.val

      if (bound.context) {
        execContext.call(this, bound, event, data)
        bound.context[0].bind.setContextChain(bound.context)
      }

      if (bind) {
        bind.clearContextUp()
        this.execInternal(bind, event, data)
        // removal is too fast for condition!
      }

      delete binds[i]
    }

    if (isEmpty(binds)) {
      delete this.binds
    }
  }
}

function execContext (bound, event, data) {
  for (let j in bound) {
    if (isNumberLike(j)) {
      if (bound[j].chain) {
        let bind = this.setContextChain(bound[j].chain)
        this.execInternal(bind, event, data)
{'fraction_non_alphanumeric': 0.14044665012406948, 'fraction_numerical': 0.0009925558312655087, 'mean_word_length': 2.365609348914858, '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': '1980251', 'n_tokens_mistral': 660, 'n_tokens_neox': 640, 'n_words': 166}