MCPcopy
hub / github.com/vuejs/core / normalizeStyle

Function normalizeStyle

packages/shared/src/normalizeProp.ts:5–25  ·  view source on GitHub ↗
(
  value: unknown,
)

Source from the content-addressed store, hash-verified

3export type NormalizedStyle = Record<string, string | number>
4
5export function normalizeStyle(
6 value: unknown,
7): NormalizedStyle | string | undefined {
8 if (isArray(value)) {
9 const res: NormalizedStyle = {}
10 for (let i = 0; i < value.length; i++) {
11 const item = value[i]
12 const normalized = isString(item)
13 ? parseStringStyle(item)
14 : (normalizeStyle(item) as NormalizedStyle)
15 if (normalized) {
16 for (const key in normalized) {
17 res[key] = normalized[key]
18 }
19 }
20 }
21 return res
22 } else if (isString(value) || isObject(value)) {
23 return value
24 }
25}
26
27const listDelimiterRE = /;(?![^(]*\))/g
28const propertyDelimiterRE = /:([^]+)/

Callers 9

stringifyElementFunction · 0.90
ssrRenderStyleFunction · 0.90
propHasMismatchFunction · 0.90
_createVNodeFunction · 0.90
mergePropsFunction · 0.90
convertLegacyPropsFunction · 0.90
renderFunction · 0.90
normalizePropsFunction · 0.85

Calls 3

isStringFunction · 0.90
isObjectFunction · 0.90
parseStringStyleFunction · 0.85

Tested by 1

renderFunction · 0.72