var assert = function(a, m){ if(!a)throw new Error(m||"") }
function test(quasis, ...expressionValues){
var {raw} = quasis;
assert(quasis.length);
assert(raw.length);
assert(quasis.length === raw.length);
assert(expressionValues.length);
if(quasis.length === 0)return '';
expressionValues = expressionValues.map( (x) => `(${x})` )
var s = '', i = 0, len = raw.length;
while (true) {
s += raw[i];
if (i + 1 === len) {
return s;
}
s += expressionValues[i++];
}
}
var value = 'val';
var a = test`\n<${ 40 + 2 }>\t - \n<${ value }>\t`
var b = `\n${ 40 + 2 }\t`
var c = String.raw`\n<${ 40 + 2 }>\t - \n<${ value }>\t`
console.log(a, a === '\\n<(42)>\\t - \\n<(val)>\\t')
console.log(b, b === '\n42\t')
console.log(c, c === '\\n<42>\\t - \\n<val>\\t' )
proposal
tests from here