{"size": 1156, "ext": "js", "max_stars_repo_path": "src/modules/logs/playerLogWidgets/addLogWidgets.js", "max_stars_repo_name": "srijanpaul-deepsource/fallenswordhelper", "max_stars_repo_stars_event_min_datetime": "2017-07-22T01:52:20.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-04T17:19:20.000Z", "max_issues_repo_path": "src/modules/logs/playerLogWidgets/addLogWidgets.js", "max_issues_repo_name": "srijanpaul-deepsource/fallenswordhelper", "max_issues_repo_issues_event_min_datetime": "2015-05-18T20:40:40.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T23:20:41.000Z", "max_forks_repo_path": "src/modules/logs/playerLogWidgets/addLogWidgets.js", "max_forks_repo_name": "srijanpaul-deepsource/fallenswordhelper", "max_forks_repo_forks_event_min_datetime": "2016-07-22T12:37:27.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-06T15:19:00.000Z"}
{"max_stars_count": 5, "max_issues_count": 305, "max_forks_count": 13, "avg_line_length": 32.1111111111, "max_line_length": 76, "alphanum_fraction": 0.7482698962}
import addAttackLink from './addAttackLink';
import addIgnoreLinks from './addIgnoreLinks';
import addPvPSummary from './addPvPSummary';
import changeLabels from './changeLabels';
import colorPlayers from './colorPlayers';
import getLastTable from './getLastTable';
import getValue from '../../system/getValue';
import jQueryNotPresent from '../../common/jQueryNotPresent';
import partial from '../../common/partial';
import processLadder from './processLadder';

const conditionalArray = [
  ['addIgnoreLink', addIgnoreLinks],
  ['colorPlayerNames', colorPlayers],
  ['addAttackLinkToLog', addAttackLink],
  ['changeButtonLabels', changeLabels],
  ['trackLadderReset', processLadder],
  ['showPvPSummaryInLog', addPvPSummary],
];

function processConditionals(logTable, privMsg, pair) {
  if (getValue(pair[0])) {
    pair[1](logTable, privMsg);
  }
}

function foundLogTable(logTable, privMsg) {
  conditionalArray.forEach(partial(processConditionals, logTable, privMsg));
}

export default function addLogWidgets(privMsg) {
  if (jQueryNotPresent()) { return; }
  const logTable = getLastTable();
  if (logTable) { foundLogTable(logTable, privMsg); }
}
