<commit_before>import getFightName from 'common/getFightName';
import prettyEncodeURI from 'common/prettyEncodeURI';

export function makePlainUrl(reportCode = undefined, fightId = undefined, fightName = undefined, playerId = undefined, playerName = undefined, tab = undefined) {
  const parts = [];
  if (reportCode) {
    parts.push(`report/${reportCode}`);
    if (fightId) {
      parts.push(fightName ? `${fightId}-${prettyEncodeURI(fightName)}` : `${fightId}`);
      if (playerId) {
        parts.push(playerName ? `${playerId}-${prettyEncodeURI(playerName)}` : `${playerId}`);
        if (tab) {
          parts.push(tab);
        }
      }
    }
  }
  return `/${parts.join('/')}`;
}

export default function makeReportUrl(report = undefined, fightId = undefined, playerId = undefined, tab = undefined) {
  const parts = [];
  if (report) {
    parts.push(`report/${report.code}`);
    if (fightId) {
      const fight = report.fights.find(fight => fight.id === fightId);
      const fightName = fight && getFightName(report, fight);
      if (fightName) {
        parts.push(`${fightId}-${prettyEncodeURI(fightName)}`);
        if (playerId) {
          const player = report.friendlies.find(friendly => friendly.id === playerId);
          const playerName = player ? player.name : null;
          if (playerName) {
            parts.push(`${playerId}-${prettyEncodeURI(playerName)}`);
            if (tab) {
              parts.push(tab);
            }
          }
        }
      }
    }
  }
  return `/${parts.join('/')}`;
}
<commit_msg>code style unification (ternary addition to check undefined)<commit_after>import getFightName from 'common/getFightName';
import prettyEncodeURI from 'common/prettyEncodeURI';

export function makePlainUrl(reportCode = undefined, fightId = undefined, fightName = undefined, playerId = undefined, playerName = undefined, tab = undefined) {
  const parts = [];
  if (reportCode) {
    parts.push(`report/${reportCode}`);
    if (fightId) {
      parts.push(fightName ? `${fightId}-${prettyEncodeURI(fightName)}` : `${fightId}`);
      if (playerId) {
        parts.push(playerName ? `${playerId}-${prettyEncodeURI(playerName)}` : `${playerId}`);
        if (tab) {
          parts.push(tab);
        }
      }
    }
  }
  return `/${parts.join('/')}`;
}

export default function makeReportUrl(report = undefined, fightId = undefined, playerId = undefined, tab = undefined) {
  const parts = [];
  if (report) {
    parts.push(`report/${report.code}`);
    if (fightId) {
      const fight = report.fights.find(fight => fight.id === fightId);
      const fightName = fight ? getFightName(report, fight) : null;
      if (fightName) {
        parts.push(`${fightId}-${prettyEncodeURI(fightName)}`);
        if (playerId) {
          const player = report.friendlies.find(friendly => friendly.id === playerId);
          const playerName = player ? player.name : null;
          if (playerName) {
            parts.push(`${playerId}-${prettyEncodeURI(playerName)}`);
            if (tab) {
              parts.push(tab);
            }
          }
        }
      }
    }
  }
  return `/${parts.join('/')}`;
}

{'fraction_non_alphanumeric': 0.1591125198098257, 'fraction_numerical': 0.0, 'mean_word_length': 2.820823244552058, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3385823', 'n_tokens_mistral': 963, 'n_tokens_neox': 961, 'n_words': 194}