MCPcopy Create free account
hub / github.com/appium/appium / sortPullRequests

Function sortPullRequests

scripts/github-contrib-stats.mjs:67–82  ·  view source on GitHub ↗

* Sort PRs by author login (asc), then by merged date (asc) * @param {GitHubPullRequest[]} pullRequests * @returns {GitHubPullRequest[]}

(pullRequests)

Source from the content-addressed store, hash-verified

65 * @returns {GitHubPullRequest[]}
66 */
67function sortPullRequests(pullRequests) {
68 return [...pullRequests].sort((a, b) => {
69 const aAuthor = (a.author?.login || '').toLowerCase();
70 const bAuthor = (b.author?.login || '').toLowerCase();
71 if (aAuthor < bAuthor) {
72 return -1;
73 }
74 if (aAuthor > bAuthor) {
75 return 1;
76 }
77 // If authors are equal, sort by merged date
78 const aMerged = a.merged_at ? new Date(a.merged_at).getTime() : 0;
79 const bMerged = b.merged_at ? new Date(b.merged_at).getTime() : 0;
80 return aMerged - bMerged;
81 });
82}
83
84/**
85 * Get the date range for the last calendar month

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected