Skip to content

Instantly share code, notes, and snippets.

@chiplay
Created August 13, 2013 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiplay/6220286 to your computer and use it in GitHub Desktop.
Save chiplay/6220286 to your computer and use it in GitHub Desktop.
JS Maybe Monad Patter
// from http://osteele.com/posts/2007/12/monads-on-the-cheap-i-the-maybe-monad
var locationCode = ((cartDelivery||{}).Location||{}).Code;
if (locationCode) {
var name = RF.Models.Cart.get('Delivery').Location.Name;
return name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment