Created
October 6, 2018 17:32
-
-
Save rpetrich/43ffaef00fab55082c65ba58d2fe33b8 to your computer and use it in GitHub Desktop.
Coalesce operator in swift-to-js
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
export function coalesce$option$(option) { | |
return option !== null ? option : false; | |
} |
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
public func coalesce(option: Bool?) -> Bool { | |
return option ?? false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment