Import old content, load from disk

This commit is contained in:
Christoph Hagen
2024-11-18 20:19:20 +01:00
parent 0989f06d87
commit 943d8d962b
24 changed files with 1326 additions and 210 deletions

View File

@ -0,0 +1,9 @@
import Foundation
extension Optional {
func map<T>(_ transform: (Wrapped) throws -> T?) rethrows -> T? {
guard let self else { return nil }
return try transform(self)
}
}

View File

@ -0,0 +1,11 @@
import Foundation
extension Sequence {
func sorted<T>(ascending: Bool = true, using conversion: (Element) -> T) -> [Element] where T: Comparable {
guard ascending else {
return sorted { conversion($0) > conversion($1) }
}
return sorted { conversion($0) < conversion($1) }
}
}