0.0.4 • Published 5 years ago

wtf-nhl v0.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

wtf-nhl is a wrapper of wtf_wikipedia that supports a bunch of different variants of nhl game log variations, that are used sometimes in the wild.

wtfNHL.fetch('Toronto Maple Leafs', 2018).then(console.log)
// {
//   roster:[ { name: 'Mitch Marner',
//        games: 40,
//        goals: 15,
//        assists: 40,
//        points: 55,
//        plusMinus: 16 },
//        ...
//      ]
//   games: [{ game: 1,
//        date: 'October 3',
//        opponent: 'Montreal Canadiens',
//        location: 'Scotiabank Arena',
//        score: { win: 3, loss: 2 },
//        overtime: true,
//        record: { wins: 1, losses: 0, ties: 0 },
//        attendance: null,
//        points: 2 },
//        ...
//   ]
// }

//or if you already have the doc,
var json = wtfNHL.parse(doc)

to do a bunch of years in a row:

wtfNHL.history('St. Louis Blues', 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))
})

See also:

(work-in-progress)

MIT

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago