On Tue, Oct 28, 2014 at 4:12 PM, Kevin Smith <[email protected]> wrote:

>
>> I'd like to be able to do something like:
>>
>>     function safe_html(template_string) {
>>         // note: mapping dictionary d constructed explicitly, not based
>> on what's in scope where template literal appeared
>>         var d = { x: 'strong', u: 'world'};
>>         return template_expand(template_string, d);
>>     }
>>
>>
> Does it help to think in terms of arrow functions?  We're assuming that
> the caller knows about the template and the callee knows about the data.
> If so, then we can do something like this instead:
>
>    let formatted = getData(data => `<${data.x}>hello, ${data.u}</${x}>`);
>

Nice.  Yes, with the reduced syntactic overhead afforded by =>, this could
indeed be quite helpful for my use case. I'll keep it mind.

Thanks,

  -Antony
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to