# contributions

> GitHub Contribution Count

Latest version **0.8.0** (published 2023-12-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install contributions
pnpm add contributions
yarn add contributions
bun add contributions
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.0 |
| Published | 2023-12-04 |
| First published | 2020-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 109.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Edward Thomson |
| Maintainers | ethomson |
| Keywords | GitHub, Contribution |

## Links

- npm: https://www.npmjs.com/package/contributions
- Repository: https://github.com/ethomson/contributions
- Homepage: https://github.com/ethomson/contributions#readme
- Issues: https://github.com/ethomson/contributions/issues
- npm.io page: https://npm.io/package/contributions

## Dependencies (2)

- [jsdom](https://npm.io/package/jsdom.md) ^16.4.0
- [@types/jsdom](https://npm.io/package/@types/jsdom.md) ^16.2.5

## Recent versions

- 0.8.0 (latest) — 2023-12-04
- 0.7.0 — 2023-08-18
- 0.6.0 — 2023-02-17
- 0.5.0 — 2021-02-10
- 0.4.0 — 2021-01-12
- 0.3.0 — 2021-01-12
- 0.2.0 — 2020-10-30
- 0.1.0 — 2020-06-30

## README

# GitHub Contributions

A TypeScript library for the [GitHub Contribution Graph](https://help.github.com/en/github/setting-up-and-managing-your-github-profile/viewing-contributions-on-your-profile).

## Usage

1. Get the contributions for a GitHub user, by name:

       const contributions = await Contributions.forUser('ethomson');

2. Get the days in the contribution graph:

       const days = contributions.getDays();

3. You can iterate and inspect the data in each day:

   1. Get the date, a string in `YYYY-MM-DD` format:

          day.getDate();

   2. Get the number of contributions on that day:

          day.getCount();

   3. Get the contribution intensity for the day, which is the number 0-4, where 0 indicates no contributions, and 4 is the most contributions.  This maps to the color used to indicate the contribution count for the graph.

          day.getIntensity();

   4. Get the color, a string in hexadecimal `#xxxxxx` format, that GitHub used for displaying this day in the contribution graph (this maps directly to the "intensity" level for the day:

## Example

Add the [`contributions`](http://npmjs.com/contributions) package (eg, `npm install contributions`).  Then:

```javascript
const { Contributions } = require('contributions')

const contributions = await Contributions.forUser('ethomson');
const days = contributions.getDays();

for (let day of days) {
    console.log(`${day.getDate()}: ${day.getIntensity()}`);
}
```

## License

contributions is released under the MIT license.

See the [license file](LICENSE.txt) for the full license text.

---
_Source: https://npm.io/package/contributions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
