This is PascalCase: SomeSymbol

This is camelCase: someSymbol

This is snake_case: some_symbol

So my questions is whether there is a widely accepted name for this: some-symbol? It's commonly used in url's.


Solution 1:

There isn't really a standard name for this case convention, and there is disagreement over what it should be called.

That said, as of 2019, there is a strong case to be made that kebab-case is winning:

https://trends.google.com/trends/explore?date=all&q=kebab-case,spinal-case,lisp-case,dash-case,caterpillar-case

spinal-case is a distant second, and no other terms have any traction at all.

Additionally, kebab-case has entered the lexicon of several javascript code libraries, e.g.:

  • https://lodash.com/docs/#kebabCase
  • https://www.npmjs.com/package/kebab-case
  • https://vuejs.org/v2/guide/components-props.html#Prop-Casing-camelCase-vs-kebab-case

However, there are still other terms that people use. Lisp has used this convention for decades as described in this Wikipedia entry, so some people have described it as lisp-case. Some other forms I've seen include caterpillar-case, dash-case, and hyphen-case, but none of these is standard.

So the answer to your question is: No, there isn't a single widely-accepted name for this case convention analogous to snake_case or camelCase, which are widely-accepted.

Solution 2:

It's referred to as kebab-case. See lodash docs.

Solution 3:

It's also sometimes known as caterpillar-case

Solution 4:

Adding the correct link here Kebab Case

which is All lowercase with - separating words.