2 ms·
It's nice that they implemented string templates essentially exactly the same way Javascript template literals and tag functions work. They even give an example
by hn_throwaway_99 3y ago
It's nice that they implemented string templates essentially exactly the same way Javascript template literals and tag functions work. They even give an example of using it to create a prepared statement (e.g. DB."SELECT * FROM foo WHERE bar = \{inputParam}") which is exactly what many NodeJS libraries due, e.g. Slonik https://github.com/gajus/slonik https://github.com/gajus/slonik, like sql`SELECT * FROM foo WHERE bar = ${inputParam}`;
- maxloh 3y agoNot quite. Dedenting template literal is a pain in the ass, which should have been supported from day one. The TC39 committee actually come up with an additional proposal for that use case.