<commit_before>module.exports = function (walkCreator) {
  return function (context) {
    var dispatch = context.dispatch

    return function (next) {
      return function (action) {
        var walk = walkCreator(action)
        var dispatchWith = dispatcher(dispatch)(walk)

        findError(walk, action)(action.type)

        if (action.meta && action.meta.promise) {
          var resolve = dispatchWith(walk.resolve)
          var reject = dispatchWith(walk.reject)

          if (typeof action.meta.promise === 'function') {
            setTimeout(function () {
              action.meta.promise(resolve, reject)
            })
          } else {
            action.meta.promise.then(resolve).catch(reject)
          }
        } else if (walk) {
          setTimeout(function () {
            dispatchWith()(action.payload)
          })
        }

        next(action)
      }
    }
  }
}

var error = {
  promise: {
    noWalk: function (type) {
      throw new Error('Found promise in \'' + type + '\' but there is no walk for it')
    },
    missingCallback: function (type) {
      throw new Error('The walk for \'' + type + '\' needs to be a callback, or to have a `resolve` or/and `reject` callback when there is a promise in it')<commit_msg>Use ['catch'] instead of .catch so IE 8 does not crash<commit_after>module.exports = function (walkCreator) {
  return function (context) {
    var dispatch = context.dispatch

    return function (next) {
      return function (action) {
        var walk = walkCreator(action)
        var dispatchWith = dispatcher(dispatch)(walk)

        findError(walk, action)(action.type)

        if (action.meta && action.meta.promise) {
          var resolve = dispatchWith(walk.resolve)
          var reject = dispatchWith(walk.reject)

          if (typeof action.meta.promise === 'function') {
            setTimeout(function () {
              action.meta.promise(resolve, reject)
            })
          } else {
            action.meta.promise.then(resolve)['catch'](reject)
          }
        } else if (walk) {
          setTimeout(function () {
            dispatchWith()(action.payload)
          })
        }

        next(action)
      }
    }
  }
}

var error = {
  promise: {
    noWalk: function (type) {
      throw new Error('Found promise in \'' + type + '\' but there is no walk for it')
    },
    missingCallback: function (type) {
      throw new Error('The walk for \'' + type + '\' needs to be a callback, or to have a `resolve` or/and `reject` callback when there is a promise in it')
{'fraction_non_alphanumeric': 0.11787665886026542, 'fraction_numerical': 0.00039032006245121, 'mean_word_length': 2.099153567110036, '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': '1125583', 'n_tokens_mistral': 713, 'n_tokens_neox': 707, 'n_words': 199}