Created
December 13, 2017 14:00
-
-
Save loromits/0f937de931f2d8e9fb6fa954730d4af7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Dictionary { | |
func flatMapValues<T>(_ transform: (Value) throws -> T?) rethrows -> [Key: T] { | |
return try reduce(into: [:]) { $0[$1.key] = try transform($1.value) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment