What about multiple helper calls in a template - is this usefull?

Hi, currently we are working out some template helper functions to move some functionality from helpers to template.

This is a bit like using Reacts JFX mixin of code and function but within the blaze templates. Would you like to use such features?


{{ hlp.toUpper ( hlp.trim my_col_field ) }}  

Instead today:

{{#with hlp.trim my_col_field }}
    {{ hlp.toUpper this }}

or at least to write a template helper like:


function Template.foo.helpers({
    get_uppered_and_trimmed_value: function() {
        return this.my_col_field.trim().toUpper();

If you need more complex method chains, you couldn’t follow up with current Meteors options.

We are thinking about to write a helper package for that and asking you if this might be interesting / senseful or not.

Thanks for some feedback

Its a pity that the template helper call may only allow identifiers, strings etc.

So we decided to use some visual brackets to make it readable and writeable

{{ hlp.toUpper __ hlp.trim my_col_field __ }}

seems better to us than

{{ hlp.toUpper "(" hlp.trim my_col_field ")" }}

This would also work but is not required

{{ hlp.toUpper __ hlp.trim __ my_col_field __ __ }}

even with brackets

{{ hlp.toUpper "(" hlp.trim "(" my_col_field ")" ")" }}

Any suggestions or should it be better done by chaining, like?

{{ hlp.trim my_col_field oo hlp.toUpper }}
{{ hlp.trim my_col_field vv hlp.toUpper }}
{{ hlp.trim my_col_field __ hlp.toUpper }}


This is what’s possible now

{{ tpl.chain field1 tpl.trim tpl.toUpper tpl.join "," tpl.trim field2 tpl.join "," field }}

or another example

{{ tpl.trim field1 tpl.toNumber }}

or if you want to use some own helpers in a chain

{{ tpl.chain your_helper1 fields tpl.chain your_helper2 tpl.chain your_helper3 plus_arg1 plus_arg2 }}

… we are getting more and exited from that idea