1.1.1 • Published 4 years ago

github-language-usage v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

github-language-usage

Search for all the languages ​​used by a given github user and returns the average values ​​in percentages. Package is written in Typescript.

How it works

  • This package uses GitHub GraphQL API to fetch the neccessary data.
  • It will search for all the languages ​​used by a given github user and then calculate how the ratio is in percentages.
  • Depending on the token read permissions it will search in the public and private repositories of the given user.

Installation

npm:

npm i github-language-usage

or yarn:

yarn add github-language-usage

Usage

You'll need an Github OAuth token with the repo scope.

In Javascript:

import { githubLanguageUsage } from 'github-language-usage'

async function asyncCall() {
  const result = await githubLanguageUsage('<YOUR_TOKEN>', '<GITHUB_USER_NAME>')

  console.log(result)
  //=> [ { name: 'HTML', color: '#e34c26', percentage: 70}, {...} ]
}

asyncCall()

API

githubLanguageUsage(token, user, [repos])

token (string): Your Github OAuth token

user (string): The Github user name

repos (number): This is optional. It will search within the first _n_ elements from the
repositories. The default is 100

Real world example

I use it to showcase my github language usage on my personal website:

npm.io

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago