/
lib.js
29 lines (24 loc) · 982 Bytes
/
lib.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
var colors = require('colors');
module.exports.options = {
chars: { 'top': '' , 'top-mid': '' , 'top-left': '' , 'top-right': ''
, 'bottom': '' , 'bottom-mid': '' , 'bottom-left': '' , 'bottom-right': ''
, 'left': '' , 'left-mid': '' , 'mid': '' , 'mid-mid': ''
, 'right': '' , 'right-mid': '' , 'middle': ' ' },
colAligns: ['left', 'right', 'middle', 'left']
}
module.exports.colorify = function (status) {
if (status === 'FT') return status.red;
else if (status === 'HT') return status.yellow;
else if (status.indexOf("'") > -1) return status.green;
return status;
}
module.exports.isLive = function (status) {
return (status === 'HT' || status.indexOf("'") > -1);
}
module.exports.isFinished = function (status) {
return (status === 'FT');
}
module.exports.isPlaying = function (team, match) {
return match.home.toLowerCase().indexOf(team) > -1
|| match.away.toLowerCase().indexOf(team) > -1;
}