statsapi-nhl
v1.0.3
Published
A Promise-based wrapper for the National Hockey League API
Downloads
9
Readme
statsapi-nhl
statsapi-nhl provides a simple, organized way to access the NHL api.
Installing
This library is distributed on npm
. In order to add it as a dependency, run the following command:
$ npm install statsapi-nhl
Usage
Example Retrieves the roster for the 2003-2004 season of the Tampa Bay Lightning and outputs player data for all of the centers:
const nhl = require('statsapi-nhl')
var lightning = nhl.Teams.getID("Tampa Bay Lightning")
nhl.Teams.getRoster(lightning, "20032004").then((res) => {
var centers = res.filter((curr) => {
return curr.position.name === "Center";
})
console.log(centers);
}).catch((err) => {
console.log(err)
})
Example output
[ { person:
{ id: 8458192,
fullName: 'Tim Taylor',
link: '/api/v1/people/8458192',
firstName: 'Tim',
lastName: 'Taylor',
primaryNumber: '27',
birthDate: '1969-02-06',
birthCity: 'Stratford',
birthStateProvince: 'ON',
birthCountry: 'CAN',
nationality: 'CAN',
height: '6\' 1"',
weight: 190,
active: false,
rookie: false,
shootsCatches: 'L',
rosterStatus: 'N',
primaryPosition: { code: 'C', name: 'Center', type: 'Forward', abbreviation: 'C' } },
jerseyNumber: '27',
position: { code: 'C', name: 'Center', type: 'Forward', abbreviation: 'C' } },
{ person:
{ id: 8466399,
fullName: 'Eric Perrin',
link: '/api/v1/people/8466399',
firstName: 'Eric',
lastName: 'Perrin',
primaryNumber: '11',
birthDate: '1975-11-01',
birthCity: 'Laval',
...
Documentation
Team
People
Games
Schedule
Standings
Draft
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Authors
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE file for details