Skip to content

Commit c261ec2

Browse files
author
tamilr0727-ux
committed
docs(github): add JSDoc comments for achievement utilities
1 parent 292db5e commit c261ec2

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

lib/github.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
*/
499523
export function generateAchievements(
500524
totalContributions: number,
501525
currentStreak: number,

0 commit comments

Comments
 (0)