npm.io
1.0.3 • Published 3 years ago

github-leaderboard-npm-package

Licence
ISC
Version
1.0.3
Deps
1
Size
9 kB
Vulns
23
Weekly
0
Stars
4
DeprecatedThis package is deprecated

github-leaderboard-npm-package

A node module for fetching a list of highest contributors to a certain Github organization or repository with contribution scores

Installation

# using npm
npm install github-leaderboard-npm-package

# using yarn
yarn add github-leaderboard-npm-package

Usage

# using require
const leaderboard = require('github-leaderboard-npm-package');

# using import
import leaderboard from 'github-leaderboard-npm-package';

Example

Using promises:
leaderboard.initialize('GITHUB_ACCESS_TOKEN')

//fetch organization leaderboard
leaderboard.getOrganizationLeaderboard({
  orgs: 'sliit-foss',
  filters: {
      dateRange: '2021-10-14..2021-10-31',
      label: 'hacktoberfest-accepted'
  },
}).then((results) => console.log(results));

//fetch repository leaderboard
leaderboard.getRepositoryLeaderboard({
  owner: 'sliit-foss',
  repoName: 'sliitfoss',
  filters: {
      dateRange: '2021-10-14..2021-10-31',
      label: 'hacktoberfest-accepted'
  },
}).then((results) => console.log(results));
Using async/await:
leaderboard.initialize('GITHUB_ACCESS_TOKEN')
const getOrganizationLeaderboard = async function () {
    const results = await leaderboard.getOrganizationLeaderboard({
        orgs: ['sliit-foss'],
        filters: {
            dateRange: '2021-10-14..2021-10-31',
            label: 'hacktoberfest-accepted'
        },
    });
    console.log(results);
};

const getRepositoryLeaderboard = async function () {
    const results = await leaderboard.getRepositoryLeaderboard({
        owner: 'sliit-foss',
        repoName: 'sliitfoss',
        filters: {
            dateRange: '2021-10-14..2021-10-31',
            label: 'hacktoberfest-accepted'
        },
    });
    console.log(results);
};

getOrganizationLeaderboard();
getRepositoryLeaderboard();

Keywords