Skip to content

GitHub contribution graph parser - contribution streak & statistic calculator with zero dependencies

License

Notifications You must be signed in to change notification settings

jamieweavis/contribution

Repository files navigation

Contribution

GitHub contribution graph parser - contribution streak & statistic calculator with zero dependencies

ci downloads version license zero dependencies

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;
}

Built with

Related

  • Streaker - Cross-platform GitHub contribution streak/statistic tracking menu bar application with reminder notification
  • 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 file for details.

About

GitHub contribution graph parser - contribution streak & statistic calculator with zero dependencies

Topics

Resources

License

Stars

Watchers

Forks

Contributors 6