<commit_before>import React from 'react'
import assert from './util/assert'

export default function withActions(dispatcher, actions, prop = 'actions') {
  assert(typeof actions === 'object', 'Expected `actions` to be an Object.')
  return Child => class ActionContainer extends React.Component {
    render() {
      const _actions = {}
      for (let key in actions) {
        if (actions.hasOwnProperty(key)) {
          _actions[key] = (...arg) => dispatcher.dispatch(actions[key](...arg))
        }
      }

      const props = {}
      props[prop] = _actions
      return <Child {...Object.assign({}, this.props, props)}/>
    }
  }<commit_msg>Refactor withActions decorator<commit_after>import React, { Component } from 'react'
import assert from './util/assert'

export default function withActions(dispatcher, actions, prop = 'actions') {
  assert(typeof actions === 'object', 'Expected `actions` to be an Object.')

  const { dispatch } = dispatcher

  const _actions = {}
  for (let key in actions) {
    if (actions.hasOwnProperty(key)) {
      const action = actions[key]
      _actions[key] = typeof action === 'function' ?
        (...args) => dispatch(action(...args)) :
        () => dispatch(action)
    }
  }

  return Child => class ActionContainer extends Component {
    render() {
      return <Child {...this.props} {...{
        [prop]: _actions
      }}/>
    }
  }
{'fraction_non_alphanumeric': 0.1488138030194105, 'fraction_numerical': 0.0, 'mean_word_length': 2.888268156424581, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '6156884', 'n_tokens_mistral': 396, 'n_tokens_neox': 392, 'n_words': 113}