I have read about template strings in Typescript. I'd like to know if I can use them when I've read a string from a file like this:
let xmlPayloadTemplate = fs.readFileSync('payload.xml', 'utf8');
If the xmlPayloadTemplate
contains a placeholder like ${placeholder}
, is there a built-in way to perform the substitution so that I can do something like:
let variableMap = {'placeholder' : 'value' }
xmlPayloadTemplate.interpolate(variableMap)
?
I'm aware of a similar question about string interpolation in Javascript but I'd like to know if there is a better way to do it in Typescript.