(value: unknown)
| 3 | * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664 |
| 4 | */ |
| 5 | export 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 | } |
no test coverage detected