Skip to content

Commit 952bca0

Browse files
committed
refactor: remove unused GitHub ID extraction function
1 parent f5ca4fd commit 952bca0

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

website/github-avatar.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,6 @@ function fetchAvatarAsBase64(githubId) {
5555
});
5656
}
5757

58-
/**
59-
* Extracts GitHub user ID from GitHub avatar URL
60-
* @param {string} url - The GitHub avatar URL to parse
61-
* @returns {string|null} - The extracted user ID or null if extraction fails
62-
*/
63-
function extractGitHubId(url) {
64-
try {
65-
// Validate if it's a valid GitHub avatar URL
66-
if (!url.includes("avatars.githubusercontent.com/u/")) {
67-
throw new Error("Not a valid GitHub avatar URL");
68-
}
69-
70-
// Use regular expression to extract user ID
71-
const regex = /avatars\.githubusercontent\.com\/u\/(\d+)/;
72-
const match = url.match(regex);
73-
74-
if (match && match[1]) {
75-
return match[1];
76-
}
77-
return null;
78-
} catch (error) {
79-
console.error("Error:", error.message);
80-
return null;
81-
}
82-
}
83-
8458
/**
8559
* Processes a list of githubIds and adds avatar_base64 property
8660
* @param {Array} ids - Array of id
@@ -145,7 +119,7 @@ async function main() {
145119
console.log("\n==> Processing avatars");
146120
const avatarsArray = await processAvatars(uniqueGithubArray);
147121

148-
// 3. Write files
122+
// 2. Write files
149123
console.log(`\n==> Write to ${avatarFile}`);
150124
fs.writeFileSync(avatarFile, JSON.stringify(avatarsArray, null, 2));
151125

0 commit comments

Comments
 (0)