back
1 comments
This is not string interpolation. ES6 template strings can be used for multiline strings and string interpolation but that's just the basic case. What this article uses is "tagged template strings" - template strings where the interpolation is handled by a custom function. This way you can write sql`where name = ${name}` and the name parameter can be automatically escaped/sanitized.
Which seems only one step removed from calling a function with the heredoc/template string as a parameter (namely a standard way to extract template values).

Not saying that this isn't nice, I've always appreciated long string support that in Perl/Python/Ruby.