Created
September 26, 2021 08:22
-
-
Save knowankit/e1ea029718142b4205b5d00a1d99c443 to your computer and use it in GitHub Desktop.
Get all the stargazers from your git hub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getAllGithubStars = async () => { | |
const your_username = 'knowankit' | |
const URL = `https://api.github.com/users/${your_username}/repos`; | |
const response = await fetch(URL); | |
const data = await response.json(); | |
let stars = 0; | |
for (let i = 0; i < data.length; i++) { | |
stars += data[i]['stargazers_count']; | |
} | |
return stars; | |
}; | |
export default getAllGithubStars; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment