# github-language-usage

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

Latest version **1.1.1** (published 2020-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install github-language-usage
pnpm add github-language-usage
yarn add github-language-usage
bun add github-language-usage
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2020-09-23 |
| First published | 2020-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Adam Trincas |
| Maintainers | atrincas |
| Keywords | github, user, languages |

## Links

- npm: https://www.npmjs.com/package/github-language-usage
- Repository: https://github.com/atrincas/github-language-usage
- Homepage: https://github.com/atrincas/github-language-usage#readme
- Issues: https://github.com/atrincas/github-language-usage/issues
- npm.io page: https://npm.io/package/github-language-usage

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) >=2.6.1

## Recent versions

- 1.1.1 (latest) — 2020-09-23
- 1.1.0 — 2020-08-01
- 1.0.1 — 2020-07-30
- 1.0.0 — 2020-07-28

## README

# 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](https://docs.github.com/en/graphql) 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:

```bash
npm i github-language-usage
```

or yarn:

```bash
yarn add github-language-usage
```

## Usage

You'll need an Github OAuth token with the
[repo scope](https://docs.github.com/en/developers/apps/scopes-for-oauth-apps).

In Javascript:

```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](https://adamtrincas.dev/):

![](https://images2.imgbox.com/1f/c3/V8E4upe0_o.png)

---
_Source: https://npm.io/package/github-language-usage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
