Handle line break in slugified()

This commit is contained in:
Otavio Cordeiro 2025-12-22 07:58:32 +01:00 committed by Otávio
parent 8572716a73
commit 3a86d153ea

View file

@ -19,7 +19,7 @@ public extension String {
/// ``` /// ```
func slugified() -> String { func slugified() -> String {
trimmingCharacters(in: .whitespacesAndNewlines) trimmingCharacters(in: .whitespacesAndNewlines)
.components(separatedBy: .whitespaces) .components(separatedBy: .whitespacesAndNewlines)
.filter { !$0.isEmpty } .filter { !$0.isEmpty }
.joined(separator: "-") .joined(separator: "-")
} }