MCPcopy
hub / github.com/cssinjs/jss / getDynamicStyles

Function getDynamicStyles

packages/jss/src/utils/getDynamicStyles.js:4–24  ·  view source on GitHub ↗
(styles)

Source from the content-addressed store, hash-verified

2 * Extracts a styles object with only props that contain function values.
3 */
4export 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}

Callers 2

createStyleSheetFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…