fix: adding docstrings to the files where it was missing (#2101)

* fix: adding docstrings to missing files

* style: format code

* style: improve formatting

Co-authored-by: Jagruti Tiwari <jagrutit@cdac.in>
Co-authored-by: rickstaa <rick.staa@outlook.com>
This commit is contained in:
Jagruti Tiwari
2022-10-03 13:03:23 +02:00
committed by GitHub
co-authored by Jagruti Tiwari rickstaa
parent 9e1fc0b7da
commit c03bb2f250
4 changed files with 59 additions and 6 deletions
+23 -1
View File
@@ -1,4 +1,14 @@
// https://stackoverflow.com/a/5263759/10629172
/**
* Calculates the probability of x taking on x or a value less than x in a normal distribution
* with mean and standard deviation.
*
* @see https://stackoverflow.com/a/5263759/10629172
*
* @param {string} mean
* @param {number} sigma
* @param {number} to
* @returns {number} Probability.
*/
function normalcdf(mean, sigma, to) {
var z = (to - mean) / Math.sqrt(2 * sigma * sigma);
var t = 1 / (1 + 0.3275911 * Math.abs(z));
@@ -16,6 +26,18 @@ function normalcdf(mean, sigma, to) {
return (1 / 2) * (1 + sign * erf);
}
/**
* Calculates the users rank.
*
* @param {number} totalRepos
* @param {number} totalCommits
* @param {number} contributions
* @param {number} followers
* @param {number} prs
* @param {number} issues
* @param {number} stargazers
* @returns {{level: string, score: number}}} The users rank.
*/
function calculateRank({
totalRepos,
totalCommits,