19

Typically if you're converting a string of words to camel case you capitalise only the first letter of every word (bar the first word).

How does this apply to hyphenated words like re-render?

Something deep inside me wants it to be rerender or doRerender. And not reRender or doReRender, which just looks wrong to me.

Is this open to interpretation or is camel casing clear on this, and I'm just not seeing it?

Simon Hartcher
  • 3,400
  • 3
  • 30
  • 34

1 Answers1

14

In camel-case, individual trailing words are capitalized and whitespace is dropped. Since "re-render" is a single word, and since the hyphen is a non-alpha character in the same vein as whitespace, it should be treated as a single word would normally.

let rerender = "The correct answer";

The same would be true for these other examples containing hyphenated prefixes (as opposed to hyphenated standalone words):

sub-zero wedding cake         : subzeroWeddingCake
co-parent advisory hose       : coparentAdvisoryHose
ongoing trans-oceanic puppies : ongoingTransoceanicPuppies
isherwood
  • 58,414
  • 16
  • 114
  • 157