npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nbapackage

v0.1.0

Published

A small wrapper module for the NBA API endpoints

Downloads

1

Readme

NBA-Package

Installation

This package is still heavily in development. However, should anyone wish to make use of this, they can install by running

npm install git://github.com/jrmils89/nba-package.git

Disclaimer

This module is heavily dependent on the NBA keeping these endpoints open to the public. I claim no ownership of this data or have any expectation of all these endpoints remaining open forever. This readme is also a work in progress...

Usage

This is an evolving list, but here are the current endpoints

games(date, callback)

callback
  • Takes two params, err & data
date
  • Date should be queried in string format yyyymmdd

And example of an express route utilizing the games endpoint:

var nba = require('nbapackage');
var express = require('express');
var router = express.Router();

router.get('/games', function(req, res) {
  nba.games('20160311', function(err, data) {
    res.json(data);
  });
});

module.exports = router;

allPlayers(callback, leagueId, season, currentSeason)

callback
  • Takes two params, err & data
leagueId
  • Defaults to '00' which is NBA, can also pass in '20' which is the NBA D-League
leagueId
  • Expecting a season in format like '2015-16'
currentSeason
  • A true or false bool which limits to only players from this season or not

And example of an express route utilizing the games endpoint:

router.get('/players', function(req, res) {
  nba.allPlayers(function(err, data) {
    res.json(data);
  }, '00', '2015-16', true)
})

nbaPlayer(playerId, callback)

callback
  • Takes two params, err & data
playerId
  • Required param for the NBA's player ID

And example of an express route utilizing the games endpoint:

router.get('/players/:id', function(req, res) {
  nba.nbaPlayer(req.params.id, function(err, data) {
    res.json(data);
  });
});

nbadlPlayer(playerId, callback)

callback
  • Takes two params, err & data
playerId
  • Required param for the NBA D-League player ID

And example of an express route utilizing the games endpoint:

router.get('/nbadlPlayers/:id', function(req, res) {
  nba.nbadlPlayer(req.params.id, function(err, data) {
    res.json(data);
  });
});