Closed milahu closed 3 years ago
input
var s = "some 'thing' ${here}"
expected
`var s = "some 'thing' $\{here}"`
actual
'var s = "some \'thing\' ${here}"'
goal: minimize number of escapes
edit: i was looking for node's util.inspect(object)
var u = require('util') console.log(u.inspect(`var s = "some 'thing' here"`, { depth: null })) `var s = "some 'thing' here"` console.log(u.inspect(`var s = "some 'thing' $\{here}"`, { depth: null })) 'var s = "some \'thing\' ${here}"'
https://github.com/mathiasbynens/jsesc#quotes
aah, sorry. i got distracted by the demo where the quotes option is not exposed
quotes
input
expected
actual
goal: minimize number of escapes
edit: i was looking for node's util.inspect(object)