mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-08 09:55:47 +08:00
PR feedback + remove redundant code + add a test
This commit is contained in:
@@ -391,3 +391,14 @@ exports.percentageToColor = (percentage, maxHue = 90, minHue = 10) => {
|
||||
return badgeConstants.naColor;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Joins and array of string to one string after filtering out empty values
|
||||
*
|
||||
* @param {string[]} parts
|
||||
* @param {string} connector
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.filterAndJoin = (parts, connector = "") => {
|
||||
return parts.filter((part) => !!part && part !== "").join(connector);
|
||||
};
|
||||
|
Reference in New Issue
Block a user