<commit_before>import { KEYBINDING_UPDATE } from 'core/actions/types';
import { defaultCommands } from './defaults';

export default function keyboardConfigReducer(
  state = defaultCommands,
  action,
) {
  if (action.type !== KEYBINDING_UPDATE || !(command in state)) {
    return state;
  }
  const { command, keyBinding } = action.payload;
  const newCommand = Object.assign({}, state[command], { command: keyBinding });
  return Object.assign(
    {},
    state,
    { [command]: newCommand },
  );
}<commit_msg>Use switch-case for handling actions<commit_after>import { KEYBINDING_UPDATE, KEYBINDING_DEFAULT_RESET } from 'core/actions/types';
import { defaultCommands } from './defaults';

export default function keyboardConfigReducer(
  state = defaultCommands,
  action,
) {
  const { type } = action;
  switch (type) {
    case KEYBINDING_UPDATE: {
      const { command, keyBinding } = action.payload;
      return Object.assign(
        {},
        state,
        { [command]: Object.assign({}, state[command], { command: keyBinding }) },
      );
    }
    case KEYBINDING_DEFAULT_RESET:
      return defaultCommands;
    default:
      return state;
  }
}
{'fraction_non_alphanumeric': 0.12403763900769889, 'fraction_numerical': 0.0, 'mean_word_length': 3.5173745173745172, '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': '3491377', 'n_tokens_mistral': 343, 'n_tokens_neox': 345, 'n_words': 84}