refactor(perf): assign value in `if` block (#10836)

This commit is contained in:
Guo 2024-04-29 18:57:56 +08:00 committed by GitHub
parent ca7d421e87
commit c9c9dff805
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -51,8 +51,8 @@ export function stringifyStyle(
}
for (const key in styles) {
const value = styles[key]
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key)
if (isString(value) || typeof value === 'number') {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key)
// only render valid values
ret += `${normalizedKey}:${value};`
}