<commit_before>import {chan, go, operations, buffers, take, put, takeAsync, putAsync, CLOSED} from 'js-csp'

export function defineDispatcher({transformers}){
  return class {

    constructor(){
      this.outCh = chan(buffers.fixed(10))
      this.outMult = operations.mult(this.outCh)
    }

    listen(source){

      if(source.outMult && source.throughMult){
        source = source.throughMult
      } else if(source.outMult){
        source = source.outMult
      }

      const ch = chan()
      const that = this
      operations.mult.tap(source, ch)

      go(function*(){
        var value = yield take(ch)
        while (value !== CLOSED) {
          that.trigger(value)
          value = yield take(ch)
        }
      })

      return this
    }

    emit(...args){
      this.trigger(...args)
    }

    trigger(name, payload, promise){<commit_msg>add ability to ignore actions with transformers in dispatcher/bug fix<commit_after>import {chan, go, operations, buffers, take, putAsync, CLOSED} from 'js-csp'
import {compose, filter} from 'transducers.js'

export function defineDispatcher({transformers}){
  return class {

    constructor(){
      this.outCh = chan(buffers.fixed(10), compose(filter(value => !!value)))
      this.outMult = operations.mult(this.outCh)
    }

    listen(source){

      if(source.outMult && source.throughMult){
        source = source.throughMult
      } else if(source.outMult){
        source = source.outMult
      }

      const ch = chan()
      const that = this
      operations.mult.tap(source, ch)

      go(function*(){
        var value = yield take(ch)
        while (value !== CLOSED) {
          that.trigger(value)
          value = yield take(ch)
        }
      })

      return this
    }

    emit(...args){
      this.trigger(...args)
    }

    trigger(name, payload, promise){
{'fraction_non_alphanumeric': 0.1266233766233766, 'fraction_numerical': 0.0021645021645021645, 'mean_word_length': 2.3375451263537905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4693873', 'n_tokens_mistral': 573, 'n_tokens_neox': 544, 'n_words': 129}