scores-table
Advanced tools
Comparing version 0.3.0 to 1.0.0
24
cli.js
@@ -16,5 +16,7 @@ #!/usr/bin/env node | ||
' Options', | ||
' -l Outputs only live matches', | ||
' -f Outputs only finished matches', | ||
' -t <team> Outputs only matches from <team>' | ||
' -l Outputs live matches', | ||
' -f Outputs finished matches', | ||
' -t <team> Outputs matches from <team>', | ||
' -p Outputs matches from the previous day', | ||
' -n Outputs matches from the next day' | ||
].join('\n')); | ||
@@ -61,2 +63,18 @@ } | ||
if (argv === '-p') { | ||
scores.previous(function (err, data) { | ||
if (err) throw err; | ||
console.log('\n' + data); | ||
}); | ||
return; | ||
} | ||
if (argv === '-n') { | ||
scores.next(function (err, data) { | ||
if (err) throw err; | ||
console.log('\n' + data); | ||
}); | ||
return; | ||
} | ||
scores.all(function (err, data) { | ||
@@ -63,0 +81,0 @@ if (err) throw err; |
37
index.js
@@ -1,4 +0,5 @@ | ||
var scores = require('scores-parser'); | ||
var scores = require('../scores-parser/'); | ||
var lib = require('./lib'); | ||
var Table = require('cli-table'); | ||
var moment = require('moment'); | ||
@@ -8,3 +9,3 @@ var table = new Table(lib.options); | ||
module.exports.all = function (cb) { | ||
scores(function (data) { | ||
scores({}, function (data) { | ||
[].forEach.call(data, function (el) { | ||
@@ -19,3 +20,3 @@ el.status = lib.colorify(el.status); | ||
module.exports.live = function (cb) { | ||
scores(function (data) { | ||
scores({}, function (data) { | ||
[].forEach.call(data, function (el) { | ||
@@ -31,3 +32,3 @@ if (!lib.isLive(el.status)) return; | ||
module.exports.finished = function (cb) { | ||
scores(function (data) { | ||
scores({}, function (data) { | ||
[].forEach.call(data, function (el) { | ||
@@ -43,3 +44,3 @@ if (!lib.isFinished(el.status)) return; | ||
module.exports.team = function (team, cb) { | ||
scores(function (data) { | ||
scores({}, function (data) { | ||
[].forEach.call(data, function (el) { | ||
@@ -52,2 +53,26 @@ if (!lib.isPlaying(team, el)) return; | ||
}); | ||
} | ||
} | ||
module.exports.previous = function (cb) { | ||
scores({ | ||
date: moment().subtract(1, 'days').format('YYYY-MM-DD') | ||
}, function (data) { | ||
[].forEach.call(data, function (el) { | ||
el.status = lib.colorify(el.status); | ||
table.push([el.status, el.home, el.result, el.away]); | ||
}); | ||
cb(null, table.toString()); | ||
}) | ||
} | ||
module.exports.next = function (cb) { | ||
scores({ | ||
date: moment().add(1, 'days').format('YYYY-MM-DD') | ||
}, function (data) { | ||
[].forEach.call(data, function (el) { | ||
el.status = lib.colorify(el.status); | ||
table.push([el.status, el.home, el.result, el.away]); | ||
}); | ||
cb(null, table.toString()); | ||
}) | ||
} |
{ | ||
"name": "scores-table", | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"description": "football results in your command line", | ||
@@ -26,4 +26,5 @@ "bin": { | ||
"colors": "^1.0.3", | ||
"scores-parser": "1.0.1" | ||
"scores-parser": "2.0.0", | ||
"moment": "^2.8.3" | ||
} | ||
} |
@@ -37,4 +37,16 @@ # scores-table | ||
#### previous day results | ||
``` | ||
$ scores-table -p | ||
``` | ||
#### next day results | ||
``` | ||
$ scores-table -n | ||
``` | ||
## License | ||
MIT | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6749
159
2
52
4
+ Addedmoment@^2.8.3
+ Addedmoment@2.30.1(transitive)
+ Addedscores-parser@2.0.0(transitive)
- Removedscores-parser@1.0.1(transitive)
Updatedscores-parser@2.0.0