From 630fc8b5ec1f2f02d700db971a7209ebb95161e0 Mon Sep 17 00:00:00 2001 From: Guo <99574369+Plumbiu@users.noreply.github.com> Date: Mon, 29 Apr 2024 17:21:53 +0800 Subject: [PATCH] perf: assign value in `if` block --- packages/shared/src/normalizeProp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/normalizeProp.ts b/packages/shared/src/normalizeProp.ts index 07e782d44f1..db6e665d51c 100644 --- a/packages/shared/src/normalizeProp.ts +++ b/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};` }