Archive for January 31st, 2023

I thought I had a clever way of using tagged template literals with Array.prototype.reduce, but it turns out that String.raw does this already.

So my template function should be:

function template(strings, ...keys) {
  return (data) => String.raw( {raw: strings, ...keys.map (key => data[key]) );
}

Which is much simpler