Created
March 3, 2016 13:55
-
-
Save catc/d25787b6b0b3fcf7a27e to your computer and use it in GitHub Desktop.
A helper that exposes Ember.String methods as a template helper
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
import Ember from 'ember'; | |
const { String: EmberString, Helper: { helper } } = Ember; | |
/** | |
* Exposes Ember.String functions as template helpers | |
* | |
* @method stringFormatter | |
* @param {String} str | |
* @param {String} strMethod | |
* @return {String} Returns result of desired Ember.String method | |
*/ | |
export function stringFormatter([str], { strMethod }) { | |
return EmberString[`${strMethod}`](str); | |
} | |
export default helper(stringFormatter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment