volleyballsimtypes 0.0.108 → 0.0.110

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.
@@ -20,10 +20,10 @@ function transformToAttributes(set, matchId) {
20
20
  }
21
21
  exports.transformFromMatchSet = transformToAttributes;
22
22
  function transformToObject(model) {
23
- const homePlayerPosition = model.SetPositions.filter(p => p.side === 'Home')
24
- .map(_1.transformToPlayerPosition);
25
- const awayPlayerPosition = model.SetPositions.filter(p => p.side === 'Away')
26
- .map(_1.transformToPlayerPosition);
23
+ const homePlayerPosition = model.SetPositions != null ? model.SetPositions.filter(p => p.side === 'Home')
24
+ .map(_1.transformToPlayerPosition) : [];
25
+ const awayPlayerPosition = model.SetPositions != null ? model.SetPositions.filter(p => p.side === 'Away')
26
+ .map(_1.transformToPlayerPosition) : [];
27
27
  const rallies = model.Rallies != null ? model.Rallies.map(_1.transformToRally) : [];
28
28
  rallies.sort((r1, r2) => r1.order - r2.order);
29
29
  return new service_1.MatchSet({
@@ -3,5 +3,5 @@ import { Match } from '../../service';
3
3
  import { APIMatch } from '../../api';
4
4
  declare function transformToAttributes(match: Match): MatchAttributes;
5
5
  declare function transformToObject(model: MatchModel): Match;
6
- declare function transformToAPIObject(match: MatchModel, competition: CompetitionModel): APIMatch;
6
+ declare function transformToAPIObject(match: MatchModel, competition?: CompetitionModel): APIMatch;
7
7
  export { transformToObject as transformToMatch, transformToAPIObject as transformToAPIMatch, transformToAttributes as transformFromMatch };
@@ -37,8 +37,8 @@ function transformToAPIObject(match, competition) {
37
37
  awayTeam: (0, _1.transformToAPITeam)(match.AwayTeam),
38
38
  scheduledDate: new Date(match.scheduled_date),
39
39
  sets,
40
- season: competition.type === 'LEAGUE' ? (0, _1.transformToAPISeason)(competition) : undefined,
41
- tournament: competition.type === 'TOURNAMENT' ? (0, _1.transformToAPITournament)(competition) : undefined
40
+ season: competition != null && competition.type === 'LEAGUE' ? (0, _1.transformToAPISeason)(competition) : undefined,
41
+ tournament: competition != null && competition.type === 'TOURNAMENT' ? (0, _1.transformToAPITournament)(competition) : undefined
42
42
  };
43
43
  }
44
44
  exports.transformToAPIMatch = transformToAPIObject;
@@ -16,10 +16,10 @@ function transformToAttributes(set, matchId) {
16
16
  };
17
17
  }
18
18
  function transformToObject(model) {
19
- const homePlayerPosition = model.SetPositions.filter(p => p.side === 'Home')
20
- .map(transformToPlayerPosition);
21
- const awayPlayerPosition = model.SetPositions.filter(p => p.side === 'Away')
22
- .map(transformToPlayerPosition);
19
+ const homePlayerPosition = model.SetPositions != null ? model.SetPositions.filter(p => p.side === 'Home')
20
+ .map(transformToPlayerPosition) : [];
21
+ const awayPlayerPosition = model.SetPositions != null ? model.SetPositions.filter(p => p.side === 'Away')
22
+ .map(transformToPlayerPosition) : [];
23
23
  const rallies = model.Rallies != null ? model.Rallies.map(transformToRally) : [];
24
24
  rallies.sort((r1, r2) => r1.order - r2.order);
25
25
  return new MatchSet({
@@ -3,5 +3,5 @@ import { Match } from '../../service';
3
3
  import { APIMatch } from '../../api';
4
4
  declare function transformToAttributes(match: Match): MatchAttributes;
5
5
  declare function transformToObject(model: MatchModel): Match;
6
- declare function transformToAPIObject(match: MatchModel, competition: CompetitionModel): APIMatch;
6
+ declare function transformToAPIObject(match: MatchModel, competition?: CompetitionModel): APIMatch;
7
7
  export { transformToObject as transformToMatch, transformToAPIObject as transformToAPIMatch, transformToAttributes as transformFromMatch };
@@ -32,8 +32,8 @@ function transformToAPIObject(match, competition) {
32
32
  awayTeam: transformToAPITeam(match.AwayTeam),
33
33
  scheduledDate: new Date(match.scheduled_date),
34
34
  sets,
35
- season: competition.type === 'LEAGUE' ? transformToAPISeason(competition) : undefined,
36
- tournament: competition.type === 'TOURNAMENT' ? transformToAPITournament(competition) : undefined
35
+ season: competition != null && competition.type === 'LEAGUE' ? transformToAPISeason(competition) : undefined,
36
+ tournament: competition != null && competition.type === 'TOURNAMENT' ? transformToAPITournament(competition) : undefined
37
37
  };
38
38
  }
39
39
  export { transformToObject as transformToMatch, transformToAPIObject as transformToAPIMatch, transformToAttributes as transformFromMatch };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.108",
3
+ "version": "0.0.110",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",