Skip to content

Instantly share code, notes, and snippets.

@Jwpe
Created July 19, 2013 15:52
Show Gist options
  • Save Jwpe/6040220 to your computer and use it in GitHub Desktop.
Save Jwpe/6040220 to your computer and use it in GitHub Desktop.
A small Handlebars helper for checking that an item is not null or Undefined before rendering a block. Inspired by https://github.com/elving/swag/
Handlebars.registerHelper 'exists', (value, options) ->
if value? then options.fn(@) else options.inverse(@)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment