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

Leave a Reply


Warning: Undefined variable $user_ID in /home/public/blog/wp-content/themes/evanescence/comments.php on line 75