Use a ternary statement in logging code

See https://github.com/badges/shields/pull/1040#discussion_r136196343.

Closes #1040.
This commit is contained in:
Thaddee Tyl
2017-09-03 20:04:34 +02:00
parent d032090038
commit fc6c5852b2

View File

@@ -2,11 +2,7 @@
// eg. 4 becomes 04 but 17 stays 17.
function pad(string) {
string = String(string);
if (string.length < 2) {
return "0" + string;
} else {
return string;
}
return (string.length < 2) ? ('0' + string) : string;
}
// Compact date representation.