<commit_before>import {
  createStore,
  combineReducers
} from "redux";

const findEventById = function(events, id) {
  return events.find((event) => {
    return event.id === id;
  });
};

const eventsReducer = function(eventsState = [], action) {
  var newState = [].concat(eventsState);
  if (action.type === "ADD_EVENT") {
    newState.push(action.event);
  } else if (action.type === "REMOVE_EVENT") {
    var index = findEventById(eventsState, action.event.id);
    if (index !== undefined) {
      newState.splice(index, 1);
    }
  }
  return newState;
};

const userReducer = function(state, action) {
  return {};
};

const reducers = combineReducers({
  // events in the state are the ones the user has signed up for
  events: eventsReducer,
  // the `user` domain holds user metadata, like their name
  user: userReducer
});

const store = createStore(reducers);
export default store;<commit_msg>Fix removing events from user store<commit_after>import {
  createStore,
  combineReducers
} from "redux";

const findEventById = function(events, id) {
  return events.findIndex((event) => {
    return event.id === id;
  });
};

const eventsReducer = function(eventsState = [], action) {
  var newState = [].concat(eventsState);
  if (action.type === "ADD_EVENT") {
    newState.push(action.event);
  } else if (action.type === "REMOVE_EVENT") {
    var index = findEventById(eventsState, action.event.id);
    if (index !== -1) {
      newState.splice(index, 1);
    }
  }
  return newState;
};

const userReducer = function(state, action) {
  return {};
};

const reducers = combineReducers({
  // events in the state are the ones the user has signed up for
  events: eventsReducer,
  // the `user` domain holds user metadata, like their name
  user: userReducer
});

const store = createStore(reducers);
export default store;
{'fraction_non_alphanumeric': 0.13547334058759522, 'fraction_numerical': 0.001632208922742111, 'mean_word_length': 3.8522427440633247, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3325629', 'n_tokens_mistral': 592, 'n_tokens_neox': 580, 'n_words': 164}