Your design system stores CSS property names like background-color, but the component library expects JavaScript style keys like backgroundColor.
Write toStyleKey(property) that converts a property name. Remove every - and make the letter right after it uppercase. A leading - (as in vendor prefixes) works the same way, so -webkit-line-clamp becomes WebkitLineClamp.
CSS custom properties start with -- and must stay exactly as they are, so --brand-color is returned unchanged. An empty string returns an empty string.
Input: property = "background-color" Output: "backgroundColor"
The c after the dash becomes C and the dash is dropped.
Input: property = "-webkit-line-clamp" Output: "WebkitLineClamp"
The leading dash makes the w uppercase too.
0 <= property.length <= 100property contains lowercase letters, digits, and -.Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #603 CSS Property to Style Key. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.