og-tools 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -3
  2. package/src/index.js +16 -6
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "og-tools",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
7
- "test": "node test/index.test.js",
8
- "prepublishOnly": "npm test"
7
+ "test": "node test/index.test.js"
9
8
  },
10
9
  "keywords": [],
11
10
  "author": "",
package/src/index.js CHANGED
@@ -36,17 +36,16 @@ function correlateTournaments(teamA, teamB) {
36
36
  for (const seasonA of tournamentA.seasons) {
37
37
  if (seasonsB.has(seasonA.year)) {
38
38
  sharedSeasons.push({
39
- year: seasonA.year,
40
- seasonAId: seasonA.id,
41
- seasonBId: seasonsB.get(seasonA.year).id
39
+ name: seasonA.year,
40
+ id: seasonA.id,
42
41
  });
43
42
  }
44
43
  }
45
44
 
46
45
  if (sharedSeasons.length > 0) {
47
46
  result.push({
48
- tournamentId: id,
49
- tournamentName: tournamentA.uniqueTournament.name,
47
+ id: id,
48
+ name: tournamentA.uniqueTournament.name,
50
49
  slug: tournamentA.uniqueTournament.slug,
51
50
  seasons: sharedSeasons
52
51
  });
@@ -59,9 +58,20 @@ function correlateTournaments(teamA, teamB) {
59
58
  }
60
59
  }
61
60
 
61
+ function singleTournamentCorrelate(data) {
62
+
63
+ return data.map(t => ({
64
+ name: t.uniqueTournament.name,
65
+ slug: t.uniqueTournament.slug,
66
+ id: t.uniqueTournament.id,
67
+ seasons: t.seasons
68
+ }));
69
+
70
+ }
62
71
 
63
72
 
64
73
  module.exports = {
65
74
  comillas,
66
- correlateTournaments
75
+ correlateTournaments,
76
+ singleTournamentCorrelate
67
77
  };