(k: string, v: unknown)
| 5 | const negate = (cond: string) => `not ${cond}` |
| 6 | |
| 7 | const keyVal = (k: string, v: unknown): string => { |
| 8 | const realKey = hyphenate(k) |
| 9 | |
| 10 | // px shorthand |
| 11 | if (typeof v === 'number') { |
| 12 | v = `${v}px` |
| 13 | } |
| 14 | if (v === true) { |
| 15 | return realKey |
| 16 | } |
| 17 | if (v === false) { |
| 18 | return negate(realKey) |
| 19 | } |
| 20 | return `(${realKey}: ${v})` |
| 21 | } |
| 22 | |
| 23 | const join = (conds: string[]): string => conds.join(' and ') |
| 24 |