T.J. Crowder (2018-12-13T18:44:29.000Z)
tj.crowder at farsightsoftware.com (2018-12-13T18:48:05.621Z)
On Thu, Dec 13, 2018 at 6:37 PM T.J. Crowder <tj.crowder at farsightsoftware.com> wrote: > > But called normally, it's a useful helper, for instance in > Isiah's `escape`... Going through the process of the example for my message just now made me think more about this function. Suppose it: 1. Accepted an array of substitutions rather than a rest parameter, and 2. Accepted an optional mapping function Then, what I wrote on my last message as: ```js const escape = (strings, ...subs) => { return String.cook(strings, ...subs.map(escapeHTML)); }; ``` would be ```js const escape = (strings, ...subs) => String.cook(strings, subs, escapeHTML); ``` (http://jsfiddle.net/n6p7xcvm/1/) ...while still supporting the earlier usage (just without spread) if desired. -- T.J. Crowder