]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor(perf): assign value in `if` block (#10836)
authorGuo <99574369+Plumbiu@users.noreply.github.com>
Mon, 29 Apr 2024 10:57:56 +0000 (18:57 +0800)
committerGitHub <noreply@github.com>
Mon, 29 Apr 2024 10:57:56 +0000 (18:57 +0800)
packages/shared/src/normalizeProp.ts

index 07e782d44f1376b85552bb5e732b0854408cd7b3..db6e665d51cadb3e8914ebad91d6d7bca7a408ff 100644 (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};`
     }