https://github.com/jamieweavis/contribution
GitHub contribution graph parser - contribution streak & statistic calculator with zero dependencies
https://github.com/jamieweavis/contribution
contribution contribution-graph github statistics stats streak
Last synced: about 2 months ago
JSON representation
GitHub contribution graph parser - contribution streak & statistic calculator with zero dependencies
- Host: GitHub
- URL: https://github.com/jamieweavis/contribution
- Owner: jamieweavis
- License: mit
- Created: 2017-11-06T10:03:54.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T13:09:38.000Z (3 months ago)
- Last Synced: 2025-04-14T14:27:53.801Z (3 months ago)
- Topics: contribution, contribution-graph, github, statistics, stats, streak
- Language: TypeScript
- Homepage: https://npm.im/contribution
- Size: 2.11 MB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Contribution
GitHub contribution graph parser - contribution streak & statistic calculator with zero dependencies
[](https://github.com/jamieweavis/contribution/actions)
[](https://npmjs.com/package/contribution)
[](https://github.com/jamieweavis/contribution/releases)
[](https://github.com/jamieweavis/contribution/blob/main/LICENSE)
[](https://npmjs.com/package/contribution)## Install
```sh
npm install contribution
```## Usage
```javascript
import { fetchGitHubStats } from 'contribution';// Promise chaining
fetchGitHubStats('jamieweavis')
.then((gitHubStats) => console.info(gitHubStats))
.catch((error) => console.error(error));// Try catch with async/await
try {
const gitHubStats = await fetchGitHubStats('jamieweavis');
console.info(gitHubStats);
} catch (error) {
console.error(error);
}
``````typescript
interface GitHubStats {
bestStreak: number;
currentStreak: number;
previousStreak: number;isStreakAtRisk: boolean;
mostContributions: number;
todaysContributions: number;
totalContributions: number;contributions: Contributions;
}interface Contributions {
[date: string]: Day; // YYYY-MM-DD
}interface Day {
contributions: number;
gitHubLegendLevel: number;
}
```## Built with
- [Node.js](https://github.com/nodejs/node)
- [TypeScript](https://github.com/microsoft/TypeScript)
- [Parcel](https://github.com/parcel-bundler/parcel)## Related
- [Streaker](https://github.com/jamieweavis/streaker) - Cross-platform GitHub contribution streak/statistic tracking menu bar application with reminder notification
- [Streaker CLI](https://github.com/jamieweavis/streaker-cli) - GitHub contribution streak/statistic tracking command line application with ASCII contribution graph## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.