og-players 0.0.5 → 0.0.6
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.
- package/package.json +1 -1
- package/src/index.js +15 -10
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -30,12 +30,13 @@ function _construct_incomers(data = {}) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function _construct_players(p, nationals
|
|
33
|
+
function _construct_players(p, nationals) {
|
|
34
34
|
const plates = ogDates(p?.dateOfBirthTimestamp);
|
|
35
35
|
const plurrency = ogCurrency(p?.proposedMarketValue ?? 0);
|
|
36
36
|
const plontrato = ogDates(p?.contractUntilTimestamp);
|
|
37
37
|
|
|
38
|
-
const isNational = nationals.
|
|
38
|
+
const isNational = nationals.some(s => s.player.id === p.id); // some es más eficiente que filter
|
|
39
|
+
|
|
39
40
|
|
|
40
41
|
const injury_start = ogDates(p?.injury?.startDateTimestamp);
|
|
41
42
|
const injury_end = ogDates(p?.injury?.endDateTimestamp);
|
|
@@ -49,18 +50,22 @@ function _construct_players(p, nationals = []) {
|
|
|
49
50
|
age: plates?.since?.years ?? "?",
|
|
50
51
|
height: p?.height,
|
|
51
52
|
shirt: p?.shirtNumber,
|
|
52
|
-
market: plurrency,
|
|
53
|
+
market: plurrency.label,
|
|
53
54
|
contract: p?.contractUntilTimestamp
|
|
54
55
|
? { date: plontrato.date, remain: plontrato.remain }
|
|
55
56
|
: false,
|
|
56
|
-
national:
|
|
57
|
-
|
|
57
|
+
national: {
|
|
58
|
+
status: isNational ? true : false,
|
|
59
|
+
label: isNational ? '⚽' : '--'
|
|
60
|
+
},
|
|
61
|
+
injured: p?.injury?.reason
|
|
58
62
|
? {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
label: `Reason: ${p.injury.reason} | Remain ${injury_end.remain.days} Dias, ${injury_end.remain.months} meses`,
|
|
64
|
+
reason: p.injury.reason,
|
|
65
|
+
status: p.injury.status,
|
|
66
|
+
started: injury_start,
|
|
67
|
+
ended: injury_end,
|
|
68
|
+
}
|
|
64
69
|
: false,
|
|
65
70
|
};
|
|
66
71
|
}
|