Skip to content

Instantly share code, notes, and snippets.

@tonywok
Created June 23, 2014 22:12
Show Gist options
  • Save tonywok/a954531b5395d52ead6f to your computer and use it in GitHub Desktop.
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
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