refactor: migrate to using arrow functions (#2033)

This commit is contained in:
Rick Staa
2022-11-21 10:07:09 +01:00
committed by GitHub
parent b2e34ac8db
commit 4b656ebabb
6 changed files with 45 additions and 45 deletions
+2 -2
View File
@@ -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;
+3 -3
View File
@@ -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;
+2 -2
View File
@@ -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;