@jonasdoesthings/github-contributions
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

github-contributions

A simple TypeScript library to fetch GitHub's contribution chart for a user

LICENSE npm version

Installation

npm install @jonasdoesthings/github-contributions
or
yarn add @jonasdoesthings/github-contributions

Usage

import {fetchContributions} from '@jonasdoesthings/github-contributions';

fetchContributions("JonasDoesThings").then((contributionsYear) => {
  console.log(contributionsYear);
  console.log(contributionsYear.contributions[14].numberOfContributions);
});

fetchContributions("JonasDoesThings", 2021).then((contributionsYear) => {
  console.log(contributionsYear.totalNumberOfContributions);
  console.log(contributionsYear.contributions.find((day) => day.date === '2021-08-29')?.numberOfContributions);
});

API

fetchContributions(username [string], <optional: year [number]>)
Returns: Promise<ContributionsYear>.

See src/types/contribution_year.ts for the type definition.

Testing

Run yarn test to execute all tests.

License

The project is licensed under the MIT license.
Check the LICENSE file, for the full legal-notice.

Dependencies (1)

Dev Dependencies (9)

Package Sidebar

Install

npm i @jonasdoesthings/github-contributions

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

20.3 kB

Total Files

10

Last publish

Collaborators

  • jonasdoesthings