$.escape should be renamed to $.raw
What is the problem this feature would solve?
$.escape does the opposite of what the name implies
What is the feature you are proposing to solve the problem?
Deprecate $.escape and add $.raw
What alternatives have you considered?
$.unescape? :-)
fully agree this is confusing. i would expect escape to... well, escape the input.
reasonable
This is a mistake in the docs, $.escape actually does what is expected:
console.log($.escape('$(foo) `bar` "baz"'))
// Prints: \$(foo) \`bar\` \"baz\"
If you want to pass a string as raw input, use { raw: 'str' }:
await $`echo ${{ raw: '$(foo) `bar` "baz"' }}`
Thanks for clarification, this makes much more sense :)
On Fri, Feb 2, 2024, 2:14 PM Zack Radisic @.***> wrote:
This is a mistake in the docs, $.escape actually does what is expected:
console.log($.escape('$(foo)
bar"baz"'))// Prints: $(foo) `bar` "baz"If you want to pass a string as raw input, use { raw: 'str' }:
await $
echo ${{ raw: '$(foo)bar"baz"' }}— Reply to this email directly, view it on GitHub https://github.com/oven-sh/bun/issues/8318#issuecomment-1924705532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABW4QKXTYZE56YF4QBAZDYRVJK5AVCNFSM6AAAAABCDV4DOKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRUG4YDKNJTGI . You are receiving this because you authored the thread.Message ID: @.***>
let's fix the documentation of this. i was actually unaware of this too
Fixed f77b217