Remove duplicate normalizeColor calls (#5534)

* Remove duplicate normalizeColor calls

* Clarify behaviour with comment
This commit is contained in:
Pierre-Yves B
2020-09-13 22:11:22 +02:00
committed by GitHub
parent bf4fd96059
commit f1007a5ee2

View File

@@ -23,17 +23,16 @@ module.exports = function makeBadge({
const [label, message] = text
color = normalizeColor(color)
labelColor = normalizeColor(labelColor)
// This ought to be the responsibility of the server, not `makeBadge`.
if (format === 'json') {
return JSON.stringify({
label,
message,
logoWidth,
color,
labelColor,
// Only call normalizeColor for the JSON case: this is handled
// internally by toSvgColor in the SVG case.
color: normalizeColor(color),
labelColor: normalizeColor(labelColor),
link: links,
name: label,
value: message,