Files
svgl/src/utils/getStarsRepository.ts
T
2023-05-10 17:06:42 -03:00

11 lines
335 B
TypeScript

export async function fetchGitHubStars() {
const res = await fetch('https://api.github.com/repos/pheralb/svgl');
const response = await res.json();
const starsFormated =
response.stargazers_count > 1000
? `${(response.stargazers_count / 1000).toFixed(1)}K`
: response.stargazers_count;
return starsFormated;
}