MCPcopy Index your code
hub / github.com/BingyanStudio/github-analyzer / parseCommits

Function parseCommits

api/src/services/generateReport.ts:53–81  ·  view source on GitHub ↗
(nodes: any)

Source from the content-addressed store, hash-verified

51}
52
53function parseCommits(nodes: any): Repository[] {
54 return nodes
55 .filter(
56 (repo: any) =>
57 repo !== null &&
58 repo.mainCommits !== null &&
59 repo.mainCommits.target !== null
60 )
61 .map((repo: any) => {
62 const { nameWithOwner, description, mainCommits } = repo;
63 // Handle null mainCommits with optional chaining and default to empty array
64 const nodes = mainCommits?.target?.history?.nodes;
65 const commits =
66 nodes?.map((commit: any) => {
67 return {
68 message: commit.message,
69 committedDate: new Date(commit.committedDate).toLocaleString(
70 "zh-CN"
71 ),
72 };
73 }) || [];
74 return {
75 nameWithOwner,
76 description,
77 commits: commits.filter((commit: any) => commit !== null),
78 };
79 })
80 .filter((repo: any) => repo.commits && repo.commits.length > 0);
81}
82
83function parsePullRequests(nodes: any): PullRequest[] {
84 return nodes.map((pr) => {

Callers 2

fetchUserDataBatchedFunction · 0.85
fetchUserDataPagedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected