๐ GitHub contribution streak & stat fetcher with zero dependencies
$ npm install contribution
import { fetchStats } from 'contribution';
// Callbacks
fetchStats('jamieweavis', {
onSuccess: data => console.log(data),
onFailure: error => console.log(error),
});
// Promises
fetchStats('jamieweavis')
.then(data => console.log(data))
.catch(error => console.log(error));
// Async/await
async function getContributionData() {
try {
const data = await fetchStats('jamieweavis');
console.log(data);
} catch (error) {
console.log(error);
}
}
Type: Function
Returns: Promise
Resolves: Object
Resolves an object with the following structure:
{
streak: {
best: Number,
current: Number,
},
contributions: {
best: Number,
current: Number,
total: Number,
}
}
Type: String
The GitHub username to fetch contribution data for.
Type: Object
Type: Function
Parameters: data
Callback function to handle the returned data. Passed a data
object which has the same structure as the resolved data object above.
Type: Function
Parameters: error
Callback function to handle an error. Passed an error
object which corresponds to a HTTP Response with error.statusCode
etc.
Type: Boolean
Default: false
Whether to proxy the request through the cors-anywhere API to enable fetching data x-origin. Set this option to true if you are using contribution
through the browser.
- streaker - ๐ GitHub contribution streak & stat tracking menu bar app
- streaker-cli - ๐ GitHub contribution streak & stat tracking CLI app