Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc03bb2f

Browse files
JagrutitiJagruti Tiwaririckstaa
authored
fix: adding docstrings to the files where it was missing (anuraghazra#2101)
* fix: adding docstrings to missing files* style: format code* style: improve formattingCo-authored-by: Jagruti Tiwari <jagrutit@cdac.in>Co-authored-by: rickstaa <rick.staa@outlook.com>
1 parent9e1fc0b commitc03bb2f

File tree

4 files changed

+59
-6
lines changed

4 files changed

+59
-6
lines changed

‎src/calculateRank.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
// https://stackoverflow.com/a/5263759/10629172
1+
/**
2+
* Calculates the probability of x taking on x or a value less than x in a normal distribution
3+
* with mean and standard deviation.
4+
*
5+
*@see https://stackoverflow.com/a/5263759/10629172
6+
*
7+
*@param {string} mean
8+
*@param {number} sigma
9+
*@param {number} to
10+
*@returns {number} Probability.
11+
*/
212
functionnormalcdf(mean,sigma,to){
313
varz=(to-mean)/Math.sqrt(2*sigma*sigma);
414
vart=1/(1+0.3275911*Math.abs(z));
@@ -16,6 +26,18 @@ function normalcdf(mean, sigma, to) {
1626
return(1/2)*(1+sign*erf);
1727
}
1828

29+
/**
30+
* Calculates the users rank.
31+
*
32+
*@param {number} totalRepos
33+
*@param {number} totalCommits
34+
*@param {number} contributions
35+
*@param {number} followers
36+
*@param {number} prs
37+
*@param {number} issues
38+
*@param {number} stargazers
39+
*@returns {{level: string, score: number}}} The users rank.
40+
*/
1941
functioncalculateRank({
2042
totalRepos,
2143
totalCommits,

‎src/cards/stats-card.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ import {
1212
import{getStyles}from"../getStyles.js";
1313
import{statCardLocales}from"../translations.js";
1414

15+
/**
16+
* Create a stats card text item.
17+
*
18+
*@param {object[]} createTextNodeParams Object that contains the createTextNode parameters.
19+
*@param {string} createTextNodeParams.label The label to display.
20+
*@param {string} createTextNodeParams.value The value to display.
21+
*@param {string} createTextNodeParams.id The id of the stat.
22+
*@param {number} createTextNodeParams.index The index of the stat.
23+
*@param {boolean} createTextNodeParams.showIcons Whether to show icons.
24+
*@param {number} createTextNodeParams.shiftValuePos Number of pixels the value has to be shifted to the right.
25+
*@param {boolean} createTextNodeParams.bold Whether to bold the label.
26+
*@returns
27+
*/
1528
constcreateTextNode=({
1629
icon,
1730
label,

‎src/common/retryer.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import{CustomError,logger}from"./utils.js";
22

3+
/**
4+
* Try to execute the fetcher function until it succeeds or the max number of retries is reached.
5+
*
6+
*@param {object[]} retryerParams Object that contains the createTextNode parameters.
7+
*@param {object[]} retryerParams.fetcher The fetcher function.
8+
*@param {object[]} retryerParams.variables Object with arguments to pass to the fetcher function.
9+
*@param {number} retryerParams.retries How many times to retry.
10+
*@returns Promise<retryer>
11+
*/
312
constretryer=async(fetcher,variables,retries=0)=>{
413
if(retries>7){
514
thrownewCustomError("Maximum retries exceeded",CustomError.MAX_RETRY);

‎src/common/utils.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,23 @@ function parseBoolean(value) {
7474
}
7575

7676
/**
77-
*@param {string} str
77+
* Parse string to array of strings.
78+
*
79+
*@param {string} str The string to parse.
80+
*@returns {string[]} The array of strings.
7881
*/
7982
functionparseArray(str){
8083
if(!str)return[];
8184
returnstr.split(",");
8285
}
8386

8487
/**
85-
*@param {number} number
86-
*@param {number} min
87-
*@param {number} max
88+
* Clamp the given number between the given range.
89+
*
90+
*@param {number} number The number to clamp.
91+
*@param {number} min The minimum value.
92+
*@param {number} max The maximum value.
93+
* returns {number} The clamped number.
8894
*/
8995
functionclampValue(number,min,max){
9096
//@ts-ignore
@@ -93,7 +99,10 @@ function clampValue(number, min, max) {
9399
}
94100

95101
/**
96-
*@param {string[]} colors
102+
* Check if the given string is a valid gradient.
103+
*
104+
*@param {string[]} colors Array of colors.
105+
* returns {boolean} True if the given string is a valid gradient.
97106
*/
98107
functionisValidGradient(colors){
99108
returnisValidHexColor(colors[1])&&isValidHexColor(colors[2]);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp