Browse Source

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

Guo 2 years ago
parent
commit
c9c9dff805
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/shared/src/normalizeProp.ts

+ 1 - 1
packages/shared/src/normalizeProp.ts

@@ -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};`
     }