Improve storage
This commit is contained in:
@ -2,6 +2,10 @@ import Foundation
|
||||
|
||||
extension Optional {
|
||||
|
||||
func `default`(_ defaultValue: Wrapped) -> Wrapped {
|
||||
self ?? defaultValue
|
||||
}
|
||||
|
||||
func map<T>(_ transform: (Wrapped) throws -> T?) rethrows -> T? {
|
||||
guard let self else { return nil }
|
||||
return try transform(self)
|
||||
|
Reference in New Issue
Block a user