MCPcopy Create free account
hub / github.com/shipshapecode/shepherd / countStars

Function countStars

landing/src/lib/github.ts:8–26  ·  view source on GitHub ↗
(
  repo = 'shipshapecode/shepherd'
)

Source from the content-addressed store, hash-verified

6let starCount: number | undefined = undefined;
7
8export async function countStars(
9 repo = 'shipshapecode/shepherd'
10): Promise<number> {
11 if (starCount) {
12 return starCount;
13 }
14
15 try {
16 const repoData = await fetch(`https://api.github.com/repos/${repo}`);
17 const json = await repoData.json();
18
19 starCount = json.stargazers_count * 1 || defaultStarCount;
20 } catch (e) {
21 console.log('Failed to fetch stars', e);
22 starCount = defaultStarCount;
23 }
24
25 return starCount;
26}
27
28export async function getFormattedStars(
29 repo = 'shipshapecode/shepherd'

Callers 1

getFormattedStarsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected