Socket
Book a DemoInstallSign in
Socket

@jharrilim/balldontlie-client

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jharrilim/balldontlie-client

js client for balldontlie api

0.7.2
latest
npmnpm
Version published
Maintainers
1
Created
Source

balldontlie-client

Build Status NPM Badge NPM Downloads

Javascript client for Balldontlie.

API Docs for this client can be found here.

Rasheed Wallace - Ball Dont Lie

API Implementation Status

APIStatus
Players
Teams
Games
Stats
Season Averages

Install

npm i @jharrilim/balldontlie-client

Usage

This library uses async generators for handling pagination. You may use this in conjunction with for-await-of to make multiple API requests. You may also request for one page at a time by awaiting .next().

Axios is used interally, and axios configuration options may be passed into .v1() if needed.

Warning: This API is rate limited. You may only make up to 60 requests per minute.

Example with for-await-of

import { BallDontLie } from '@jharrilim/balldontlie-client';

void async function main() {
    const v1Client = BallDontLie.v1();
    for await(const teams of v1Client.teams(0)) {
        // paginate through all the teams
        for(const team of teams) {
            console.log(team.full_name);
        }
    }
}().catch(console.error);

Example with .next()

import { BallDontLie } from '@jharrilim/balldontlie-client';

void async function main() {
    const v1Client = BallDontLie.v1();
    const teamGenerator = v1Client.teams(0, 10); // starting from 0, 10 per page
    
    const teams1 = (await teamGenerator.next()).value; // get the first 10 teams
    teams1.forEach(team => console.log(team.full_name));

    const teams2 = (await teamGenerator.next()).value; // get the next 10 teams after the first 10
    teams2.forEach(team => console.log(team.full_name));

}().catch(console.error);

More examples can be found in the tests.

Keywords

ball

FAQs

Package last updated on 14 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.