<commit_before>import {
  SELECT_ITEM, UNSELECT_ITEM,
} from '../actions';

export function currentSelection (state = {
  items: [],
}, action) {
  switch (action.type) {
  case SELECT_ITEM:
    return Object.assign({}, state, {
      items: state.items.concat(Object.assign({}, action.item)),
    });

  case UNSELECT_ITEM:
    return Object.assign({}, state, {
      items: state.items.filter(item => {
        return item._id !== action._id;
      }),
    });

  default:
    return state;
  }
}<commit_msg>currentSelection.items now Object<commit_after>import {
  SELECT_ITEM, UNSELECT_ITEM,
} from '../actions';

export function currentSelection (state = {
  items: {},
}, action) {
  const _id = action.item ? action.item._id : '';
  const items = {};

  switch (action.type) {
  case SELECT_ITEM:
    if (state.items[_id]) {
      return state;
    }
    items[_id] = action.item;
    return {
      items: Object.assign({}, state.items, items),
    };

  case UNSELECT_ITEM:
    if (!state.items[_id]) {
      return state;
    }
    Object.assign(items, state.items);
    delete items[_id];
    return {items};

  default:
    return state;
  }
}
{'fraction_non_alphanumeric': 0.15411255411255412, 'fraction_numerical': 0.0, 'mean_word_length': 2.8662207357859533, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1863407', 'n_tokens_mistral': 378, 'n_tokens_neox': 367, 'n_words': 83}