contribution
Version:
GitHub contribution graph parser - contribution streak & statistic calculator with zero dependencies
75 lines (54 loc) • 2.18 kB
Markdown
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)
```sh
npm install contribution
```
```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 {
[]: Day; // YYYY-MM-DD
}
interface Day {
contributions: number;
gitHubLegendLevel: number;
}
```
- [Node.js](https://github.com/nodejs/node)
- [TypeScript](https://github.com/microsoft/TypeScript)
- [Parcel](https://github.com/parcel-bundler/parcel)
- [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
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.