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

Function normalizeCssVarValue

packages/shared/src/cssVars.ts:5–24  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

3 * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664
4 */
5export function normalizeCssVarValue(value: unknown): string {
6 if (value == null) {
7 return 'initial'
8 }
9
10 if (typeof value === 'string') {
11 return value === '' ? ' ' : value
12 }
13
14 if (typeof value !== 'number' || !Number.isFinite(value)) {
15 if (__DEV__) {
16 console.warn(
17 '[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:',
18 value,
19 )
20 }
21 }
22
23 return String(value)
24}

Callers 4

cssVars.spec.tsFile · 0.90
ssrResetCssVarsFunction · 0.90
setVarsOnNodeFunction · 0.90
resolveCssVarsFunction · 0.90

Calls 2

StringInterface · 0.85
warnMethod · 0.80

Tested by

no test coverage detected