(obj: any)
| 175 | }; |
| 176 | |
| 177 | export const stringifyStyle = (obj: any): string => { |
| 178 | if (obj == null) { |
| 179 | return ''; |
| 180 | } |
| 181 | if (typeof obj == 'object') { |
| 182 | if (isArray(obj)) { |
| 183 | throw qError(QError_stringifyClassOrStyle, obj, 'style'); |
| 184 | } else { |
| 185 | const chunks: string[] = []; |
| 186 | for (const key in obj) { |
| 187 | if (Object.prototype.hasOwnProperty.call(obj, key)) { |
| 188 | const value = obj[key]; |
| 189 | if (value != null && typeof value !== 'function') { |
| 190 | if (key.startsWith('--')) { |
| 191 | chunks.push(key + ':' + value); |
| 192 | } else { |
| 193 | chunks.push(fromCamelToKebabCase(key) + ':' + setValueForStyle(key, value)); |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | return chunks.join(';'); |
| 199 | } |
| 200 | } |
| 201 | return String(obj); |
| 202 | }; |
| 203 | |
| 204 | export const setValueForStyle = (styleName: string, value: any) => { |
| 205 | if (typeof value === 'number' && value !== 0 && !isUnitlessNumber(styleName)) { |
no test coverage detected
searching dependent graphs…