Skip to content

Commit

Permalink
Refactor: Top langs card: Use typedef tags inside data fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 committed Aug 10, 2023
1 parent 75d378d commit 7d1a417
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/fetchers/top-languages-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ import {
wrapTextMultiline,
} from "../common/utils.js";

/**
* @typedef {import("axios").AxiosRequestHeaders} AxiosRequestHeaders Axios request headers.
* @typedef {import("axios").AxiosResponse} AxiosResponse Axios response.
*/

/**
* Top languages fetcher object.
*
* @param {import('axios').AxiosRequestHeaders} variables Fetcher variables.
* @param {AxiosRequestHeaders} variables Fetcher variables.
* @param {string} token GitHub token.
* @returns {Promise<import('../common/types').StatsFetcherResponse>} Languages fetcher response.
* @returns {Promise<AxiosResponse>} Languages fetcher response.
*/
const fetcher = (variables, token) => {
return request(
Expand Down Expand Up @@ -47,12 +52,18 @@ const fetcher = (variables, token) => {
);
};

/**
* @typedef {import("./types").TopLangData} TopLangData Top languages data.
*/

/**
* Fetch top languages for a given username.
*
* @param {string} username GitHub username.
* @param {string[]} exclude_repo List of repositories to exclude.
* @returns {Promise<import("./types").TopLangData>} Top languages data.
* @param {number} size_weight Weightage to be given to size.
* @param {number} count_weight Weightage to be given to count.
* @returns {Promise<TopLangData>} Top languages data.
*/
const fetchTopLanguages = async (
username,
Expand Down

0 comments on commit 7d1a417

Please sign in to comment.