<commit_before>import isObservable from '../util/isObservable'
import isPromise from '../util/isPromise'

export function createThunkMiddleware(...extraArgs) {
  return dispatcher => agenda => agenda.map(thunkish => {
    if (typeof thunkish === 'function') {
      const res = thunkish(
        x => dispatcher.next(x),
        x => dispatcher.reduce(x),
        ...extraArgs
      )

      if (isObservable(res) || isPromise(res)) {
        dispatcher.next(res)
      }

      return null
    }

    return thunkish
  })<commit_msg>Fix thunk signature having anonymous functions<commit_after>import isObservable from '../util/isObservable'
import isPromise from '../util/isPromise'

export function createThunkMiddleware(...extraArgs) {
  return dispatcher => agenda => agenda.map(thunkish => {
    if (typeof thunkish === 'function') {
      const res = thunkish(
        dispatcher.next.bind(dispatcher),
        dispatcher.reduce.bind(dispatcher),
        ...extraArgs)

      if (isObservable(res) || isPromise(res)) {
        dispatcher.next(res)
      }

      return null
    }

    return thunkish
  })
{'fraction_non_alphanumeric': 0.12769784172661872, 'fraction_numerical': 0.0, 'mean_word_length': 2.7474747474747474, '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': '2815046', 'n_tokens_mistral': 331, 'n_tokens_neox': 326, 'n_words': 73}