()
| 24 | * Allow camel cased property names by converting them back to dasherized. |
| 25 | */ |
| 26 | export 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…