README
npm install wtf-mlb
wtf-mlb is a wrapper of wtf_wikipedia that supports a bunch of different variants of mlb game log variations, that are used sometimes in the wild.
wtfMLB.fetch('Toronto Blue Jays', 2018).then(console.log)
//[{
// date: 'April 1',
// team: 'Reds',
// home: false,
// result: { us: 6, them: 5, win: true },
// record: { wins: 3, losses: 0, games: 3
// },
// ....
//or if you already have the doc,
var json = wtfMLB.parse(doc)
to do a bunch of years in a row:
wtfMLB.history('St. Louis Cardinals', 1992, 1997).catch(console.log).then(data => {
data = data.map((obj) => {
//grab just the date and attendance
obj.games = obj.games.map((g) => [g.date, g.attendance])
return obj
})
console.log(JSON.stringify(data, null, 2))
})
(work-in-progress)
MIT