( styles: NormalizedStyle | string | undefined, )
| 43 | } |
| 44 | |
| 45 | export function stringifyStyle( |
| 46 | styles: NormalizedStyle | string | undefined, |
| 47 | ): string { |
| 48 | if (!styles) return class="st">'' |
| 49 | if (isString(styles)) return styles |
| 50 | |
| 51 | let ret = class="st">'' |
| 52 | for (const key in styles) { |
| 53 | const value = styles[key] |
| 54 | if (isString(value) || typeof value === class="st">'number') { |
| 55 | const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key) |
| 56 | class="cm">// only render valid values |
| 57 | ret += `${normalizedKey}:${value};` |
| 58 | } |
| 59 | } |
| 60 | return ret |
| 61 | } |
| 62 | |
| 63 | export function normalizeClass(value: unknown): string { |
| 64 | let res = class="st">'' |
no test coverage detected