con

contribution

πŸ—“ GitHub contribution streak & stat fetcher with zero dependencies

Showing:

Popularity

Downloads/wk

3

GitHub Stars

7

Maintenance

Last Commit

7mos ago

Contributors

6

Package

Dependencies

0

Size (min+gzip)

0.6KB

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

Contribution

πŸ—“ GitHub contribution streak & stat fetcher with zero dependencies

build Coverage Downloads Version License Style semantic-release

Install

$ npm install contribution

Usage

import { fetchStats } from 'contribution';

// Callbacks
fetchStats('jamieweavis', {
  onSuccess: data => console.log(data),
  onFailure: error => console.log(error),
});

// Promises
fetchStats('jamieweavis')
  .then(data => console.log(data))
  .catch(error => console.log(error));

// Async/await
async function getContributionData() {
  try {
    const data = await fetchStats('jamieweavis');
    console.log(data);
  } catch (error) {
    console.log(error);
  }
}

API

fetchStats(username, [options])

Type: Function

Returns: Promise

Resolves: Object

Resolves an object with the following structure:

{
  streak: {
    best: Number,
    current: Number,
  },
  contributions: {
    best: Number,
    current: Number,
    total: Number,
  }
}

username

Type: String

The GitHub username to fetch contribution data for.

options

Type: Object

onSuccess

Type: Function

Parameters: data

Callback function to handle the returned data. Passed a data object which has the same structure as the resolved data object above.

onFailure

Type: Function

Parameters: error

Callback function to handle an error. Passed an error object which corresponds to a HTTP Response with error.statusCode etc.

enableCors

Type: Boolean

Default: false

Whether to proxy the request through the cors-anywhere API to enable fetching data x-origin. Set this option to true if you are using contribution through the browser.

  • streaker - πŸ™ GitHub contribution streak & stat tracking menu bar app
  • streaker-cli - πŸ™ GitHub contribution streak & stat tracking CLI app

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100