Last active
February 9, 2016 17:45
-
-
Save amk221/1bea7a783f76413e2e47 to your computer and use it in GitHub Desktop.
Ember escape helper
This file contains hidden or 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
import Ember from 'ember'; | |
import { helper } from 'ember-helper'; | |
import { htmlSafe } from 'ember-string'; | |
const { escapeExpression } = Ember.Handlebars.Utils; | |
/** | |
* This helper escapes a value, useful for building styles | |
* | |
* @example | |
* <div style={{escape (concat 'color:' ugcColour)}}></div> | |
* | |
*/ | |
export default helper(function(args = []) { | |
return htmlSafe(escapeExpression(args[0])); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment