Skip to content

Commit 1380017

Browse files
authored
ensure color is string before calling toLowerCase() (#10129)
1 parent c60e3dc commit 1380017

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: badge-maker/lib/color.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function normalizeColor(color) {
4949
} else if (color in aliases) {
5050
return aliases[color]
5151
} else if (isHexColor(color)) {
52-
return `#${color.toLowerCase()}`
52+
return `#${color.toString().toLowerCase()}`
5353
} else if (isCSSColor(color)) {
5454
return color.toLowerCase()
5555
} else {

Diff for: badge-maker/lib/color.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ test(normalizeColor, () => {
2727
given('blue').expect('blue')
2828
given('4c1').expect('#4c1')
2929
given('f00f00').expect('#f00f00')
30+
given('111111').expect('#111111')
31+
given(111111).expect('#111111')
3032
given('ABC123').expect('#abc123')
3133
given('#ccc').expect('#ccc')
3234
given('#fffe').expect('#fffe')

0 commit comments

Comments
 (0)