diff --git a/snippets/toKebabCase.md b/snippets/toKebabCase.md index 2eaee9f2c..7d8fe09dd 100644 --- a/snippets/toKebabCase.md +++ b/snippets/toKebabCase.md @@ -1,8 +1,8 @@ ### toKebabCase -Converts a string to snakecase. -Use `replace()` to add spaces before capital letters, convert `toLowerCase()`, then `replace()` and undesrsocres and spaces with hyphens. -Also check if a string starts with hyphen and if yes remove it. +Converts a string to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). +Use `replace()` to add spaces before capital letters, convert `toLowerCase()`, then `replace()` underscores and spaces with hyphens. +Also check if a string starts with a hyphen and remove it if yes. ```js const toKebabCase = str => { @@ -11,7 +11,6 @@ const toKebabCase = str => { } // toKebabCase("camelCase") -> 'camel-case' // toKebabCase("some text") -> 'some-text' -// toKebabCase("some-javascript-property") -> 'some-javascript-property' // toKebabCase("some-mixed_string With spaces_underscores-and-hyphens") -> 'some-mixed-string-with-spaces-underscores-and-hyphens' // toKebabCase("AllThe-small Things") -> "all-the-small-things" ```