(styles)
| 2 | * Extracts a styles object with only props that contain function values. |
| 3 | */ |
| 4 | export default function getDynamicStyles(styles) { |
| 5 | let to = null |
| 6 | |
| 7 | for (const key in styles) { |
| 8 | const value = styles[key] |
| 9 | const type = typeof value |
| 10 | |
| 11 | if (type === 'function') { |
| 12 | if (!to) to = {} |
| 13 | to[key] = value |
| 14 | } else if (type === 'object' && value !== null && !Array.isArray(value)) { |
| 15 | const extracted = getDynamicStyles(value) |
| 16 | if (extracted) { |
| 17 | if (!to) to = {} |
| 18 | to[key] = extracted |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | return to |
| 24 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…