contribution
Version:
GitHub contribution graph parser - contribution streak & statistic calculator with zero dependencies
1 lines • 1.45 kB
Source Map (JSON)
{"mappings":"AAAA;IACE,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IAEvB,cAAc,EAAE,OAAO,CAAC;IAExB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAE3B,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;IACE,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;IACE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;CACjC;ACbD,OAAA,MAAM,mBAA0B,UAAU,MAAM,KAAG,OAAO,CAAC,WAAW,CAiBrE,CAAC","sources":["src/src/transformers.ts","src/src/contribution.ts","src/contribution.ts"],"sourcesContent":[null,null,"import {\n type GitHubStats,\n type Contributions,\n type ContributionDay,\n parseContributionGraph,\n buildGitHubStats,\n} from './transformers';\n\nconst fetchGitHubStats = async (username: string): Promise<GitHubStats> => {\n try {\n const contributionGraphResponse = await fetch(\n `https://github.com/users/${username}/contributions`,\n );\n if (!contributionGraphResponse.ok) {\n throw new Error('Failed to fetch GitHub contributions');\n }\n\n const contributionGraphBody = await contributionGraphResponse.text();\n const contributions = parseContributionGraph(contributionGraphBody);\n const gitHubStats = buildGitHubStats(contributions);\n\n return gitHubStats;\n } catch (error) {\n throw new Error(error);\n }\n};\n\nexport { fetchGitHubStats };\nexport type { GitHubStats, Contributions, ContributionDay };\n"],"names":[],"version":3,"file":"contribution.d.ts.map"}