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

Function camelCase

packages/jss-plugin-camel-case/src/index.js:26–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 * Allow camel cased property names by converting them back to dasherized.
25 */
26export default function camelCase() {
27 function onProcessStyle(style) {
28 if (Array.isArray(style)) {
29 // Handle rules like @font-face, which can have multiple styles in an array
30 for (let index = 0; index < style.length; index++) {
31 style[index] = convertCase(style[index])
32 }
33 return style
34 }
35
36 return convertCase(style)
37 }
38
39 function onChangeValue(value, prop, rule) {
40 if (prop.indexOf('--') === 0) {
41 return value
42 }
43
44 const hyphenatedProp = hyphenate(prop)
45
46 // There was no camel case in place
47 if (prop === hyphenatedProp) return value
48
49 rule.prop(hyphenatedProp, value)
50
51 // Core will ignore that property value we set the proper one above.
52 return null
53 }
54
55 return {onProcessStyle, onChangeValue}
56}

Callers 4

rollup.config.jsFile · 0.85
createFunction · 0.85
index.test.jsFile · 0.85
jss.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…