addHelper
Register a helper that gets passed values.
stache.addHelper(name, helper)
Registers a helper with stache that always gets passed the value of its arguments (instead of value observables). Pass the name of the helper followed by the function to invoke.
See Helpers for more details on using helpers and registerHelper to get computes for observable values.
stache.addHelper( "upper", function( str ) {
return str.toUpperCase();
} );
Parameters
- name
{String}
:The name of the helper.
- helper
{simpleHelper(arg..., options)}
:The helper function.
stache.addHelper(helpers)
Register multiple helpers with stache that always get passed the value of its arguments (instead of value observables).
Pass an object where the key is the name of a helper and the value is the callback.
stache.addHelper({
upper: function(str) {
return str.toUpperCase();
},
lower: function(str) {
return str.toLowerCase();
}
});
Parameters
- helpers
{Object}
:an Object of name/callback pairs.