<commit_before>import { createAction, handleActions } from 'redux-actions'
import uuid from 'node-uuid'

// ------------------------------------
// Constants
// ------------------------------------
export const ADD_BUSINESS = 'ADD_BUSINESS'
export const STOCK_INCREMENT = 'STOCK_INCREMENT'

// ------------------------------------
// Actions
// ------------------------------------
export const addBusiness = createAction(ADD_BUSINESS, (value = 1) => value)
export const incrementStock = createAction(STOCK_INCREMENT, (id, value) => { return {id: id, value: value} })

export const actions = {
  addBusiness,
  incrementStock
}

// ------------------------------------
// Reducer
// ------------------------------------
// export default handleActions({
//   [ADD_BUSINESS]: (state, { payload }) => state + payload
// }, 1)

function increment_stock (state, action) {
  if (state.id !== action.payload.id) {
    return state
  }
  console.log(state)
  return {
    ...state,
    amount: state.amount + action.payload.value
  }
}
export default handleActions({
  ADD_BUSINESS: (state = [], action) => ([
    ...state,
    {
      id: uuid.v4(),
      name: action.payload,
      amount: 1
    }
  ]),
  STOCK_INCREMENT: (state = [], action) => {
    return state.map(b => increment_stock(b, action))
  }
}, [])

// export default handleActions({
//   [STOCK_INCREMENT]: (state, { payload }) => state + payload
// }, 1)
<commit_msg>remove logging<commit_after>import { createAction, handleActions } from 'redux-actions'
import uuid from 'node-uuid'

// ------------------------------------
// Constants
// ------------------------------------
export const ADD_BUSINESS = 'ADD_BUSINESS'
export const STOCK_INCREMENT = 'STOCK_INCREMENT'

// ------------------------------------
// Actions
// ------------------------------------
export const addBusiness = createAction(ADD_BUSINESS, (value = 1) => value)
export const incrementStock = createAction(STOCK_INCREMENT, (id, value) => { return {id: id, value: value} })

export const actions = {
  addBusiness,
  incrementStock
}

// ------------------------------------
// Reducer
// ------------------------------------
// export default handleActions({
//   [ADD_BUSINESS]: (state, { payload }) => state + payload
// }, 1)

function increment_stock (state, action) {
  if (state.id !== action.payload.id) {
    return state
  }
  return {
    ...state,
    amount: state.amount + action.payload.value
  }
}
export default handleActions({
  ADD_BUSINESS: (state = [], action) => ([
    ...state,
    {
      id: uuid.v4(),
      name: action.payload,
      amount: 1
    }
  ]),
  STOCK_INCREMENT: (state = [], action) => {
    return state.map(b => increment_stock(b, action))
  }
}, [])

// export default handleActions({
//   [STOCK_INCREMENT]: (state, { payload }) => state + payload
// }, 1)

{'fraction_non_alphanumeric': 0.2869718309859155, 'fraction_numerical': 0.0035211267605633804, 'mean_word_length': 1.812871287128713, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2953002', 'n_tokens_mistral': 838, 'n_tokens_neox': 805, 'n_words': 192}