File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -496,6 +496,30 @@ export async function getWrappedData(username: string, year: string) {
496496 * UTILS & EXPORTS
497497 * ========================================================================== */
498498
499+ /**
500+ * Generates contribution and streak achievement metadata for a user.
501+ *
502+ * Achievements are unlocked when the provided contribution count
503+ * or streak value meets the corresponding milestone threshold.
504+ *
505+ * Progress values are clamped between 0 and 100 using `Math.min`
506+ * to prevent percentages from exceeding 100%.
507+ *
508+ * @param totalContributions - Total number of contributions made by the user.
509+ * @param currentStreak - Current active contribution streak in days.
510+ * @param weekendCommits - Total number of contributions made on weekends.
511+ * @param uniqueLanguages - Number of distinct languages used.
512+ *
513+ * @returns An array of achievement objects for contribution and streak milestones,
514+ * including unlock status, progress percentage, threshold values, and display metadata.
515+ *
516+ * @example
517+ * ```ts
518+ * const achievements = generateAchievements(125, 10);
519+ *
520+ * console.log(achievements);
521+ * ```
522+ */
499523export function generateAchievements (
500524 totalContributions : number ,
501525 currentStreak : number ,
You can’t perform that action at this time.
0 commit comments