(obj: ClassList)
| 147 | }; |
| 148 | |
| 149 | export const serializeClass = (obj: ClassList): string => { |
| 150 | if (!obj) { |
| 151 | return ''; |
| 152 | } |
| 153 | if (isString(obj)) { |
| 154 | return obj.trim(); |
| 155 | } |
| 156 | |
| 157 | const classes: string[] = []; |
| 158 | |
| 159 | if (isArray(obj)) { |
| 160 | for (const o of obj) { |
| 161 | const classList = serializeClass(o); |
| 162 | if (classList) { |
| 163 | classes.push(classList); |
| 164 | } |
| 165 | } |
| 166 | } else { |
| 167 | for (const [key, value] of Object.entries(obj)) { |
| 168 | if (value) { |
| 169 | classes.push(key.trim()); |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | return classes.join(' '); |
| 175 | }; |
| 176 | |
| 177 | export const stringifyStyle = (obj: any): string => { |
| 178 | if (obj == null) { |
no test coverage detected
searching dependent graphs…