<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

// @flow

import { uniq } from "lodash";

import { asyncStore } from "../utils/prefs";
import type { EventListenerBreakpoints } from "../types";

type OuterState = { eventListenerBreakpoints: EventListenerBreakpoints };

function update(state: EventListenerBreakpoints = [], action: any) {
  console.log("update; state is: ", state);
  switch (action.type) {
    case "ADD_EVENT_LISTENERS":
      return updateEventTypes("add", state, action.events);

    case "REMOVE_EVENT_LISTENERS":
      return updateEventTypes("remove", state, action.events);

    default:
      return state;
  }
}

function updateEventTypes(
  addOrRemove: string,
  currentEvents: EventListenerBreakpoints,
  events: EventListenerBreakpoints
): EventListenerBreakpoints {
  let newEventListeners;

  if (addOrRemove === "add") {
    newEventListeners = uniq([...currentEvents, ...events]);
  } else {
    newEventListeners = currentEvents.filter(event => !events.includes(event));
  }

  asyncStore.eventListenerBreakpoints = newEventListeners;
  return newEventListeners;
}

export function getActiveEventListeners(state: OuterState) {
  return state.eventListenerBreakpoints;
}

export default update;
<commit_msg>Remove unwanted console.log (#7732)<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

// @flow

import { uniq } from "lodash";

import { asyncStore } from "../utils/prefs";
import type { EventListenerBreakpoints } from "../types";

type OuterState = { eventListenerBreakpoints: EventListenerBreakpoints };

function update(state: EventListenerBreakpoints = [], action: any) {
  switch (action.type) {
    case "ADD_EVENT_LISTENERS":
      return updateEventTypes("add", state, action.events);

    case "REMOVE_EVENT_LISTENERS":
      return updateEventTypes("remove", state, action.events);

    default:
      return state;
  }
}

function updateEventTypes(
  addOrRemove: string,
  currentEvents: EventListenerBreakpoints,
  events: EventListenerBreakpoints
): EventListenerBreakpoints {
  let newEventListeners;

  if (addOrRemove === "add") {
    newEventListeners = uniq([...currentEvents, ...events]);
  } else {
    newEventListeners = currentEvents.filter(event => !events.includes(event));
  }

  asyncStore.eventListenerBreakpoints = newEventListeners;
  return newEventListeners;
}

export function getActiveEventListeners(state: OuterState) {
  return state.eventListenerBreakpoints;
}

export default update;

{'fraction_non_alphanumeric': 0.11281138790035587, 'fraction_numerical': 0.004270462633451958, 'mean_word_length': 4.416184971098266, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 7, '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': '7464001', 'n_tokens_mistral': 819, 'n_tokens_neox': 805, 'n_words': 225}