mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
3 lines
150 B
Swift
3 lines
150 B
Swift
|
|
/// Returns `f(x!)` if `x != nil`, or `nil` otherwise.
|
|
public func given<T, U>(_ x: T?, _ f: (T) throws -> U) rethrows -> U? { return try x.map(f) }
|