(styleObject: { [key: string]: any })
| 11 | }; |
| 12 | |
| 13 | export const jsToInlineCss = (styleObject: { [key: string]: any }) => { |
| 14 | const parts: string[] = []; |
| 15 | |
| 16 | for (const key in styleObject) { |
| 17 | const value = styleObject[key]; |
| 18 | if (value !== 0 && value !== undefined && value !== null && value !== '') { |
| 19 | const KEBAB_CASE_REGEX = /[A-Z]/g; |
| 20 | const formattedKey = key.replace( |
| 21 | KEBAB_CASE_REGEX, |
| 22 | (match) => `-${match.toLowerCase()}`, |
| 23 | ); |
| 24 | parts.push(`${formattedKey}:${value}`); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | return parts.join(';') + (parts.length ? ';' : ''); |
| 29 | }; |
| 30 | |
| 31 | const splitDeclarations = (input: string): string[] => { |
| 32 | const results: string[] = []; |
no test coverage detected