Skip to content

Search for all the languages ​​used by a given github user and returns the average values ​​in percentages

License

Notifications You must be signed in to change notification settings

atrincas/github-language-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

Search for all the languages ​​used by a given github user and returns the average values ​​in percentages

Resources

License

Stars

Watchers

Forks

Packages

No packages published