-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbatting_appearance.js
65 lines (56 loc) · 1.24 KB
/
batting_appearance.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Constructor
function BattingAppearance() {
this.pid = null;
this.batter_name = null;
this.pos = null;
this.bo = null;
this.ab = null;
this.po = null;
this.r = null;
this.bb = null;
this.a = null;
this.t = null;
this.sf = null;
this.h = null;
this.e = null;
this.d = null;
this.hbp = null;
this.so = null;
this.hr = null;
this.rbi = null;
this.lob = null;
this.sb = null;
this.avg = null; // season avg
this.fldg = null;
this.s_hr = null;
this.s_rbi = null;
};
// Used to initialize from box score data
BattingAppearance.prototype.init = function(batter) {
this.pid = batter.$.id;
this.batter_name = batter.$.name;
this.pos = batter.$.pos;
this.bo = batter.$.bo;
this.ab = batter.$.ab;
this.po = batter.$.po;
this.r = batter.$.r;
this.bb = batter.$.bb;
this.a = batter.$.a;
this.t = batter.$.t;
this.sf = batter.$.sf;
this.h = batter.$.h;
this.e = batter.$.e;
this.d = batter.$.d;
this.hbp = batter.$.hbp;
this.so = batter.$.so;
this.hr = batter.$.hr;
this.rbi = batter.$.rbi;
this.lob = batter.$.lob;
this.sb = batter.$.sb;
this.avg = batter.$.avg; // season avg
this.fldg = batter.$.fldg;
this.s_hr = batter.$.s_hr;
this.s_rbi = batter.$.s_rbi;
};
// export the class
module.exports = BattingAppearance;