contribution
v7.1.0
Published
GitHub user contribution graph parser, streak & stat calculator
Downloads
523
Maintainers
Readme
Contribution
🗓 GitHub user contribution graph parser, streak & stat calculator
Install
npm install contribution
Usage
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);
}
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;
}
Related
- Streaker - 🐙 GitHub contribution streak & stat tracking menu bar app
- Streaker CLI - 🐙 GitHub contribution streak & stat tracking command line app
License
This project is licensed under the MIT License - see the LICENSE file for details.