Updates
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
export default function twuiSlugToNormalText(str?: string) {
|
||||
if (!str) return "";
|
||||
|
||||
return str
|
||||
.toLowerCase()
|
||||
.replace(/ /g, "-")
|
||||
.replace(/[^a-z0-9\-]/g, "-")
|
||||
.replace(/-{2,}/g, "-")
|
||||
.replace(/[-]/g, " ")
|
||||
.split(" ")
|
||||
.map(
|
||||
(word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
|
||||
)
|
||||
.join(" ");
|
||||
}
|
||||
Reference in New Issue
Block a user