Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamieweavis/contribution
🗓 GitHub contribution streak & stat fetcher with zero dependencies
https://github.com/jamieweavis/contribution
contribution contribution-graph fetcher github no-dependencies statistics stats streak zero-dependency
Last synced: about 1 month ago
JSON representation
🗓 GitHub contribution streak & stat fetcher with zero dependencies
- Host: GitHub
- URL: https://github.com/jamieweavis/contribution
- Owner: jamieweavis
- License: mit
- Created: 2017-11-06T10:03:54.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-04-19T12:14:50.000Z (8 months ago)
- Last Synced: 2024-11-13T14:12:29.878Z (about 1 month ago)
- Topics: contribution, contribution-graph, fetcher, github, no-dependencies, statistics, stats, streak, zero-dependency
- Language: TypeScript
- Homepage: https://npm.im/contribution
- Size: 1.98 MB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Contribution
> 🗓 GitHub contribution streak & stat fetcher with zero dependencies
[![build](https://github.com/jamieweavis/contribution/workflows/build/badge.svg)](https://github.com/jamieweavis/contribution/actions/workflows/build.yml)
[![downloads](https://img.shields.io/npm/dt/contribution.svg)](https://npmjs.com/package/contribution)
[![version](https://img.shields.io/npm/v/contribution.svg)](https://github.com/jamieweavis/contribution/releases)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jamieweavis/contribution/blob/main/LICENSE.md)## Install
```sh
npm install contribution
```## Usage
```javascript
import { fetchStats } from 'contribution';// Callbacks
fetchStats('jamieweavis', {
onSuccess: gitHubStats => console.log(gitHubStats),
onFailure: error => console.log(error),
});// Promises
fetchStats('jamieweavis')
.then(gitHubStats => console.log(gitHubStats))
.catch(error => console.log(error));// Async/await
try {
const gitHubStats = await fetchStats('jamieweavis');
console.log(gitHubStats);
} catch (error) {
console.log(error);
}
``````typescript
interface GitHubStats {
streak: {
best: number;
current: number;
isAtRisk: boolean;
};
contributions: {
best: number;
total: number;
current: number;
};
}
```## Related
- [Streaker](https://github.com/jamieweavis/streaker) - 🐙 GitHub contribution streak & stat tracking menu bar app
- [Streaker CLI](https://github.com/jamieweavis/streaker-cli) - 🐙 GitHub contribution streak & stat tracking CLI app