<commit_before>export default middlewares => store => next => action => {

  // getting meta from action
  const meta = action.meta
  // meta object can be in action itself or in payload, if action has meta, ignore that of the payload
  if (!meta) {
    if (action.payload && action.payload.meta) {
      meta = action.payload.meta
    }
  }

  // ignore normal actions with no meta
  if (!meta)
    return next(action)

  const {handler} = meta

  let middleware = middlewares[handler]

  if (middleware) {
    // bus is not initialized, so it must be validated..
    let bus = store.getState().bus || {}

    // queue is an object
    // so it can has properties
    // other that just buffer
    // for future possible features..
    let queue = bus[handler] || {buffer: []}

    // the handler is attached and passed along
    // so we take it out of the action
    action = Object.assign({}, action)
    delete action.handler

    // this middleware will take a queue and must return a queue
    queue =  middleware(store, next, action, queue)

    // add validation that the return of the middleware is queue
    if (!queue.buffer && !queue.buffer.length) return

    // actions to update the buffer
    action = {
      type: 'UPDATE_QUEUE',
      payload: {
        queue,
        handler,
      },
    }
    store.dispatch(action)
  }
  return next(action)
}
<commit_msg>fix bug<commit_after>export default middlewares => store => next => action => {

  // getting meta from action
  let meta = action.meta
  // meta object can be in action itself or in payload, if action has meta, ignore that of the payload
  if (!meta) {
    if (action.payload && action.payload.meta) {
      meta = action.payload.meta
    }
  }

  // ignore normal actions with no meta
  if (!meta)
    return next(action)

  const {handler} = meta

  let middleware = middlewares[handler]

  if (middleware) {
    // bus is not initialized, so it must be validated..
    let bus = store.getState().bus || {}

    // queue is an object
    // so it can has properties
    // other that just buffer
    // for future possible features..
    let queue = bus[handler] || {buffer: []}

    // the handler is attached and passed along
    // so we take it out of the action
    action = Object.assign({}, action)
    delete action.handler

    // this middleware will take a queue and must return a queue
    queue =  middleware(store, next, action, queue)

    // add validation that the return of the middleware is queue
    if (!queue.buffer && !queue.buffer.length) return

    // actions to update the buffer
    action = {
      type: 'UPDATE_QUEUE',
      payload: {
        queue,
        handler,
      },
    }
    store.dispatch(action)
  }
  return next(action)
}

{'fraction_non_alphanumeric': 0.10174418604651163, 'fraction_numerical': 0.0, 'mean_word_length': 2.3903940886699506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '6768943', 'n_tokens_mistral': 786, 'n_tokens_neox': 763, 'n_words': 309}