Home

function: kebabCase


kebabCase(string: string): string

Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).

Example(s):

kebabCase('Foo Bar')
// => 'foo-bar'

kebabCase('fooBar')
// => 'foo-bar'

kebabCase('__FOO_BAR__')
// => 'foo-bar'

Params:

Name Type Attribute Description
string The string to convert.

Returns:

string

  {
    "comment": "/**\r\n * Converts `string` to\r\n * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\r\n *\r\n * @since 3.0.0\r\n * @category String\r\n * @param {string} [string=''] The string to convert.\r\n * @returns {string} Returns the kebab cased string.\r\n * @see camelCase, lowerCase, snakeCase, startCase, upperCase, upperFirst\r\n * @example\r\n *\r\n * kebabCase('Foo Bar')\r\n * // => 'foo-bar'\r\n *\r\n * kebabCase('fooBar')\r\n * // => 'foo-bar'\r\n *\r\n * kebabCase('__FOO_BAR__')\r\n * // => 'foo-bar'\r\n */",
    "meta": {
        "range": [
            545,
            721
        ],
        "filename": "kebabCase.js",
        "lineno": 23,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100005451",
            "name": "kebabCase",
            "type": "ArrowFunctionExpression"
        },
        "vars": {
            "": null
        }
    },
    "description": "Converts `string` to\r[kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).",
    "since": "3.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "String",
            "value": "String"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "optional": true,
            "defaultvalue": "''",
            "description": "The string to convert.",
            "name": "string"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "description": "Returns the kebab cased string."
        }
    ],
    "see": [
        "camelCase, lowerCase, snakeCase, startCase, upperCase, upperFirst"
    ],
    "examples": [
        "kebabCase('Foo Bar')\r// => 'foo-bar'\r\rkebabCase('fooBar')\r// => 'foo-bar'\r\rkebabCase('__FOO_BAR__')\r// => 'foo-bar'"
    ],
    "name": "kebabCase",
    "longname": "kebabCase",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000514",
    "___s": true,
    "filepath": "kebabCase.js"
}