Created
June 23, 2014 22:12
-
-
Save tonywok/a954531b5395d52ead6f to your computer and use it in GitHub Desktop.
Some helpers for dealing with missing data and handling defaults w/o making a bunch of nested if/else
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
Neo.UI.Mixin.Maybe = | |
maybeAnchored: (bool, url, dom...) -> | |
if bool | |
React.DOM.a(href: url, dom) | |
else | |
dom | |
maybeDisplayed: (bool, dom...) -> | |
if bool then dom else null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment