MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / format

Function format

site/src/lib/github.ts:8–15  ·  view source on GitHub ↗

* Build-time GitHub star count. Fetched once when the site is built (the GitHub * Actions runner has network); falls back to a constant locally / offline so a * build never hangs or fails on the network. The result is memoized for the * lifetime of the build process, so rendering it on every page

(n: number)

Source from the content-addressed store, hash-verified

6 * call, not one per page.
7 */
8function format(n: number): string {
9 if (n >= 1000) {
10 const k = n / 1000;
11 const rounded = k >= 10 ? Math.round(k) : Math.round(k * 10) / 10;
12 return `${String(rounded).replace(/\.0$/, '')}k`;
13 }
14 return String(n);
15}
16
17async function fetchStars(fallback: string): Promise<string> {
18 try {

Callers 1

fetchStarsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected