Documentation
¶
Overview ¶
Package transform provides string and data transformation utilities such as slugifying strings for URL-friendly formats.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Slugify ¶
Slugify converts a string to a URL-friendly slug matching Zod v4's slugify behavior:
- Lowercase the input
- Trim whitespace
- Remove non-word, non-space, non-hyphen characters
- Collapse consecutive whitespace, underscores, and hyphens into a single hyphen
- Trim leading and trailing hyphens
Example ¶
fmt.Println(Slugify("Hello World"))
fmt.Println(Slugify(" Multiple Spaces "))
fmt.Println(Slugify("Under_Score_And-Hyphens"))
Output: hello-world multiple-spaces under-score-and-hyphens
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.