Skip to content

kebabCase() function

str をケバブケースに変換します。空白・句読点・数字・大文字小文字の境界・頭字語を基準に単語を分割します。

Signature:

typescript
function kebabCase(str: string): string;

Example

ts
kebabCase("foo bar"); // "foo-bar"
kebabCase("fooBar"); // "foo-bar"
kebabCase("foo_bar"); // "foo-bar"
kebabCase("XMLHttpRequest"); // "xml-http-request"

Open Source Code

Released under the Apache-2.0 License.