Simplify $.escape

This commit is contained in:
Jarred Sumner
2024-01-19 19:54:17 -08:00
parent ce2ef65122
commit 4674ee16a1
3 changed files with 10 additions and 22 deletions

View File

@@ -325,14 +325,14 @@ await $.braces(`echo {1,2,3}`);
// => ["echo 1", "echo 2", "echo 3"]
```
### `$.raw` (unescaped strings)
### `$.escape` (unescaped strings)
For security purposes, Bun Shell escapes input by default. If you need to disable that, this function returns a string that is not escaped by Bun Shell:
```js
import { $ } from "bun";
await $`echo ${$.raw("Hello World!")}`;
await $`echo ${$.escape("Hello World!")}`;
// => Hello World!
```