mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-06-09 00:17:09 +00:00
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:
@@ -1,5 +1,14 @@
|
||||
import { CustomError, logger } from "./utils.js";
|
||||
|
||||
/**
|
||||
* Try to execute the fetcher function until it succeeds or the max number of retries is reached.
|
||||
*
|
||||
* @param {object[]} retryerParams Object that contains the createTextNode parameters.
|
||||
* @param {object[]} retryerParams.fetcher The fetcher function.
|
||||
* @param {object[]} retryerParams.variables Object with arguments to pass to the fetcher function.
|
||||
* @param {number} retryerParams.retries How many times to retry.
|
||||
* @returns Promise<retryer>
|
||||
*/
|
||||
const retryer = async (fetcher, variables, retries = 0) => {
|
||||
if (retries > 7) {
|
||||
throw new CustomError("Maximum retries exceeded", CustomError.MAX_RETRY);
|
||||
|
||||
+14
-5
@@ -74,7 +74,10 @@ function parseBoolean(value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* Parse string to array of strings.
|
||||
*
|
||||
* @param {string} str The string to parse.
|
||||
* @returns {string[]} The array of strings.
|
||||
*/
|
||||
function parseArray(str) {
|
||||
if (!str) return [];
|
||||
@@ -82,9 +85,12 @@ function parseArray(str) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} number
|
||||
* @param {number} min
|
||||
* @param {number} max
|
||||
* Clamp the given number between the given range.
|
||||
*
|
||||
* @param {number} number The number to clamp.
|
||||
* @param {number} min The minimum value.
|
||||
* @param {number} max The maximum value.
|
||||
* returns {number} The clamped number.
|
||||
*/
|
||||
function clampValue(number, min, max) {
|
||||
// @ts-ignore
|
||||
@@ -93,7 +99,10 @@ function clampValue(number, min, max) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]} colors
|
||||
* Check if the given string is a valid gradient.
|
||||
*
|
||||
* @param {string[]} colors Array of colors.
|
||||
* returns {boolean} True if the given string is a valid gradient.
|
||||
*/
|
||||
function isValidGradient(colors) {
|
||||
return isValidHexColor(colors[1]) && isValidHexColor(colors[2]);
|
||||
|
||||
Reference in New Issue
Block a user