From e07378ba9268046bab0348eff90b9e7fbe0be044 Mon Sep 17 00:00:00 2001 From: Jonny Date: Fri, 3 May 2019 12:19:27 +0200 Subject: [PATCH] Extract the findTeam-function --- js/utils/findTeam.js | 9 +++++++++ pages/tournament-statistics.js | 11 +---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 js/utils/findTeam.js diff --git a/js/utils/findTeam.js b/js/utils/findTeam.js new file mode 100644 index 0000000..1a9c0e6 --- /dev/null +++ b/js/utils/findTeam.js @@ -0,0 +1,9 @@ + +export function findTeam(teams, id) { + for(let i = 0; i < teams.length; i++) { + if(teams[i].id === id) { + return teams[i]; + } + } + return null; +} diff --git a/pages/tournament-statistics.js b/pages/tournament-statistics.js index dcfc34f..8457f5e 100644 --- a/pages/tournament-statistics.js +++ b/pages/tournament-statistics.js @@ -19,6 +19,7 @@ import { TurniereNavigation } from '../js/components/Navigation'; import { TournamentInformationView } from '../js/components/TournamentInformationView'; import { BigImage } from '../js/components/BigImage'; import { Footer } from '../js/components/Footer'; +import { findTeam } from '../js/utils/findTeam'; import { rangedmap } from '../js/utils/rangedmap'; import { Order, sort } from '../js/utils/sort'; @@ -43,16 +44,6 @@ class TeamRow extends React.Component { } -function findTeam(teams, id) { - for(let i = 0; i < teams.length; i++) { - if(teams[i].id === id) { - return teams[i]; - } - } - return null; -} - - class DominanceShower extends React.Component { render() {