To convert hyphenated strings to camel case (to convert css “background-image” to js “backgroundImage”):

This will also handle vendor prefixed properties appropriately… “-webkit-box-shadow” becomes “WebkitBoxShadow”.

For pascal case (where first letter is always capitalized), use this: