<commit_before>import {
  FAVE_BUS,
  UNFAVE_BUS
} from './fave-bus-actions'

const initialState = {
  faveBuses: []
}

export default function faveBuses(state = initialState, action) {

  switch (action.type) {

    case FAVE_BUS:
    
      return Object.assign({}, state, {
        faveBuses: [
          ...state.faveBuses, action.busId
        ]
      })

    case UNFAVE_BUS:

      if (state.faveBuses) {
        for ( let i = 0; i < state.faveBuses.length; i++) {
          if (state.faveBuses[i] == action.busId) {
            return Object.assign({}, state, {
              faveBuses: [
                ...state.faveBuses.slice(0, i),
                ...state.faveBuses.slice(i + 1)
              ]
            })
          }
        }
      }

    default:
      return state

  }

}<commit_msg>added faveBuses reducer to main.js<commit_after>import {
  FAVE_BUS,
  UNFAVE_BUS
} from './fave-bus-actions'

const initialState = {
  faveBuses: []
}

export default function faveBuses(state = initialState, action) {

  switch (action.type) {

    case FAVE_BUS:
    
      return Object.assign({}, state, {
        faveBuses: [
          ...state.faveBuses, action.busId
        ]
      })

    case UNFAVE_BUS:

      if (state.faveBuses) {
        for ( let i = 0; i < state.faveBuses.length; i++) {
          if (state.faveBuses[i] == action.busId) {
            return Object.assign({}, state, {
              faveBuses: [
                ...state.faveBuses.slice(0, i),
                ...state.faveBuses.slice(i + 1)
              ]
            })
          }
        }
      }

    default:
      return state

  }
  
}
{'fraction_non_alphanumeric': 0.13027522935779817, 'fraction_numerical': 0.003669724770642202, 'mean_word_length': 1.5482866043613708, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4325073', 'n_tokens_mistral': 576, 'n_tokens_neox': 554, 'n_words': 102}