Passed
Push — release/20222023-design-rework ( 2d9f50 )
by Kevin Van
09:40 queued 03:39
created

srcBU/gatsby/pageCreator.js   A

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 48
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 30
mnd 0
bc 0
fnc 6
dl 0
loc 48
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
const createTeams = (list, createPage, template) => {
2
  list.forEach(({ node }) => {
3
    createPage({
4
      path: node.path.alias,
5
      component: template,
6
      context: {
7
        slug: node.path.alias,
8
      },
9
    })
10
  })
11
}
12
13
const createPlayers = (list, createPage, template, shareTemplate) => {
14
  list.forEach(({ node }) => {
15
    createPage({
16
      path: node.path.alias,
17
      component: template,
18
      context: {
19
        slug: node.path.alias,
20
      },
21
    })
22
    createPage({
23
      path: `${node.path.alias}/share`,
24
      component: shareTemplate,
25
      context: {
26
        slug: node.path.alias,
27
      },
28
    })
29
  })
30
}
31
32
const createStaff = (list, createPage, template) => {
33
  list.forEach(({ node }) => {
34
    createPage({
35
      path: node.path.alias,
36
      component: template,
37
      context: {
38
        slug: node.path.alias,
39
      },
40
    })
41
  })
42
}
43
44
module.exports = {
45
  createTeams,
46
  createPlayers,
47
  createStaff,
48
}
49