og-players 0.0.11 → 0.0.12

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 -2
  2. package/src/index.js +10 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "og-players",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "og-currency": "^0.0.3",
21
- "og-dates": "^0.0.15",
21
+ "og-dates": "^0.0.16",
22
22
  "og-tools": "^0.0.1"
23
23
  }
24
24
  }
package/src/index.js CHANGED
@@ -37,9 +37,14 @@ function _construct_players(p, nationals) {
37
37
 
38
38
  const isNational = nationals.some(s => s.player.id === p.id); // some es más eficiente que filter
39
39
 
40
+ let injury_start = null;
41
+ let injury_end = null;
42
+
43
+ if (p?.injury) {
44
+ injury_start = ogDates(p?.injury?.startDateTimestamp);
45
+ injury_end = ogDates(p?.injury?.endDateTimestamp);
46
+ }
40
47
 
41
- const injury_start = ogDates(p?.injury?.startDateTimestamp);
42
- const injury_end = ogDates(p?.injury?.endDateTimestamp);
43
48
 
44
49
  return {
45
50
  id: p.id,
@@ -59,16 +64,14 @@ function _construct_players(p, nationals) {
59
64
  status: isNational ? true : false,
60
65
  label: isNational ? '⚽' : '--'
61
66
  },
62
- injured: p?.injury?.reason
63
- ? {
67
+ injured: p?.injury ? {
64
68
  icon: `⚠️`,
65
- label: `Reason: ${p.injury.reason} | Status: ${p.injury.status}| Remain: ${injury_end.remain.days}`,
69
+ label: `Reason: ${p.injury.reason} | Status: ${p.injury.status} | Remain: ${injury_end.remain.days}`,
66
70
  reason: p.injury.reason,
67
71
  status: p.injury.status,
68
72
  started: injury_start,
69
73
  ended: injury_end,
70
- }
71
- : {
74
+ } : {
72
75
  icon: `--`,
73
76
  label: `--`,
74
77
  },