getSlug()function
getSlug(str: string): string | undefined
| Param | Type | |
|---|---|---|
str | string | The string to convert. required |
| Return | |
|---|---|
string | undefined | The kebab-case slug, or undefined if conversion resulted in an empty string. |
Convert a string to a kebab-case URL slug, or return undefined if conversion resulted in an empty ref.
Examples
getSlug("Hello World!") // "hello-world"