(arg: ClassNamesArg)
| 25 | } |
| 26 | |
| 27 | function parseValue(arg: ClassNamesArg) { |
| 28 | if (typeof arg === 'string' || typeof arg === 'number') { |
| 29 | return arg; |
| 30 | } |
| 31 | |
| 32 | if (typeof arg !== 'object') { |
| 33 | return ''; |
| 34 | } |
| 35 | |
| 36 | if (Array.isArray(arg)) { |
| 37 | return classNames(...arg); |
| 38 | } |
| 39 | |
| 40 | let classes = ''; |
| 41 | |
| 42 | for (const key in arg) { |
| 43 | if (arg[key]) { |
| 44 | classes = appendClass(classes, key); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | return classes; |
| 49 | } |
| 50 | |
| 51 | function appendClass(value: string, newClass: string | undefined) { |
| 52 | if (!newClass) { |
no test coverage detected