Fix normalizeColor function (#10713)

This commit is contained in:
David LJ 2024-03-27 05:36:27 +01:00 committed by GitHub
parent 82e1375fc6
commit e9a3ab729e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -175,10 +175,8 @@ export const normalizeNewlines = (text) => {
export const normalizeColor = (text) => {
let color = text.replace('#', '').toUpperCase();
if (color.length < 6) {
color = color
.slice(0, 3)
.map((x) => x.repeat(2))
.join('');
// eslint-disable-next-line unicorn/no-useless-spread
color = [...color.slice(0, 3)].map((x) => x.repeat(2)).join('');
} else if (color.length > 6) {
color = color.slice(0, 6);
}