mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-08-08 18:21:33 +00:00
refactor: migrate to using arrow functions (#2033)
This commit is contained in:
@@ -60,7 +60,7 @@ const urlExample = "/api/pin?username=USERNAME&repo=REPO_NAME";
|
||||
* @param {string} reponame GitHub repository name.
|
||||
* @returns {Promise<import("./types").RepositoryData>} Repository data.
|
||||
*/
|
||||
async function fetchRepo(username, reponame) {
|
||||
const fetchRepo = async (username, reponame) => {
|
||||
if (!username && !reponame) {
|
||||
throw new MissingParamError(["username", "repo"], urlExample);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ async function fetchRepo(username, reponame) {
|
||||
starCount: data.organization.repository.stargazers.totalCount,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export { fetchRepo };
|
||||
export default fetchRepo;
|
||||
|
||||
@@ -188,12 +188,12 @@ const totalStarsFetcher = async (username, repoToHide) => {
|
||||
* @param {boolean} include_all_commits Include all commits.
|
||||
* @returns {Promise<import("./types").StatsData>} Stats data.
|
||||
*/
|
||||
async function fetchStats(
|
||||
const fetchStats = async (
|
||||
username,
|
||||
count_private = false,
|
||||
include_all_commits = false,
|
||||
exclude_repo = [],
|
||||
) {
|
||||
) => {
|
||||
if (!username) throw new MissingParamError(["username"]);
|
||||
|
||||
const stats = {
|
||||
@@ -275,7 +275,7 @@ async function fetchStats(
|
||||
});
|
||||
|
||||
return stats;
|
||||
}
|
||||
};
|
||||
|
||||
export { fetchStats };
|
||||
export default fetchStats;
|
||||
|
||||
@@ -57,7 +57,7 @@ const fetcher = (variables, token) => {
|
||||
* @param {string[]} exclude_repo List of repositories to exclude.
|
||||
* @returns {Promise<import("./types").TopLangData>} Top languages data.
|
||||
*/
|
||||
async function fetchTopLanguages(username, exclude_repo = []) {
|
||||
const fetchTopLanguages = async (username, exclude_repo = []) => {
|
||||
if (!username) throw new MissingParamError(["username"]);
|
||||
|
||||
const res = await retryer(fetcher, { login: username });
|
||||
@@ -136,7 +136,7 @@ async function fetchTopLanguages(username, exclude_repo = []) {
|
||||
}, {});
|
||||
|
||||
return topLangs;
|
||||
}
|
||||
};
|
||||
|
||||
export { fetchTopLanguages };
|
||||
export default fetchTopLanguages;
|
||||
|
||||
Reference in New Issue
Block a user