这是PascalCase: SomeSymbol

这是骆驼

这是snake_case: some_symbol

所以我的问题是,这是否有一个被广泛接受的名称:某种符号?它通常用于url。


当前回答

我一直叫它,也听人叫它“仪表盘”。

其他回答

它被称为烤肉箱。请参阅lodash文档。

我一直叫它,也听人叫它“仪表盘”。

值得一提的是从废除:

https://github.com/tpope/vim-abolish/blob/master/doc/abolish.txt#L152

仪表盘或烤串盒

这种外壳也可以被称为“slug”,将一个短语变成它的过程也可以被称为“slugify”。

https://hexdocs.pm/slugify/Slug.html

我的ECMAScript建议String.prototype.toKebabCase。

String.prototype.toKebabCase = function () {
  return this.valueOf().replace(/-/g, ' ').split('')
    .reduce((str, char) => char.toUpperCase() === char ?
      `${str} ${char}` :
      `${str}${char}`, ''
    ).replace(/ * /g, ' ').trim().replace(/ /g, '-').toLowerCase();
}