Slugify String
Converts a string into a URL-friendly slug by lowercasing and replacing non-alphanumeric characters with dashes.
slugifyString
The slugifyString function converts a string into a URL-friendly, lowercase slug. It replaces non-alphanumeric characters with dashes and trims excess separators.
Function Signature
function slugifyString(input: string): Lowercase<string>Parameters
input(string): The string to convert.
Return Value
Lowercase<string>: The slugified version of the string.
Example Usage
playground.ts
Notes
- The input is trimmed of leading and trailing whitespace before processing.
- Ideal for generating SEO-friendly URLs or route paths.
Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)
