<commit_before>import { combineReducers } from 'redux';

import { SEARCH } from '../actions/action';

const INITIAL_STATE = { whether: [] };

/**
 * @name reducer
 * @param state
 * @param action
 * @returns {Object} New state
 */
function reducer(state = INITIAL_STATE, action) {
  switch(action.type) {
    case SEARCH:
      if (action.fetching) {
          return {
              ...state,
              whether: [],
              fetching: true,
              term: action.term
          }
      }

      return {
          ...state,
          whether: action.payload,
          fetching: false,
          term: action.term
      };
    default:
      return state;
  }
}<commit_msg>feat(reducer): Use Object.assign to return always a new object. Immutability rocks.<commit_after>import { combineReducers } from 'redux';

import { SEARCH } from '../actions/action';

const INITIAL_STATE = { whether: [] };

/**
 * @name reducer
 * @param state
 * @param action
 * @returns {Object} New state
 */
function reducer(state = INITIAL_STATE, action) {
  switch(action.type) {
    case SEARCH:
      if (action.fetching) {
        return Object.assign({}, state, {
          whether: {},
          fetching: true,
          term: action.term
        })
      }

      return Object.assign({}, state, {
        whether: action.payload,
        fetching: false,
        term: action.term
      });
    default:
      return state;
  }
}
{'fraction_non_alphanumeric': 0.12849162011173185, 'fraction_numerical': 0.0, 'mean_word_length': 1.9854166666666666, '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': '4976241', 'n_tokens_mistral': 426, 'n_tokens_neox': 422, 'n_words': 108}