diff options
| author | Leo Kettmeir <crowlkats@toaxl.com> | 2023-06-05 12:25:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-05 12:25:47 +0200 |
| commit | 08bd23970dbce4ccf8103abf27e4cfa1b747705b (patch) | |
| tree | 77c84c3e3484c94eafa4f62a0d3dd822e5c703bc /ext | |
| parent | 77a950aac417ba5e9bf1a48b0ec8934291376a8c (diff) | |
feat: add more options to Deno.inspect (#19337)
For https://github.com/denoland/deno_std/issues/3404
---------
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/console/01_console.js | 5 | ||||
| -rw-r--r-- | ext/node/polyfills/internal/util/inspect.mjs | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js index dbbc549ca..11b6c549c 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -2427,6 +2427,7 @@ const denoInspectDefaultOptions = { colors: false, showProxy: false, breakLength: 80, + escapeSequences: true, compact: 3, sorted: false, getters: false, @@ -2500,7 +2501,9 @@ function quoteString(string, ctx) { ctx.quotes[0]; const escapePattern = new SafeRegExp(`(?=[${quote}\\\\])`, "g"); string = StringPrototypeReplace(string, escapePattern, "\\"); - string = replaceEscapeSequences(string); + if (ctx.escapeSequences) { + string = replaceEscapeSequences(string); + } return `${quote}${string}${quote}`; } diff --git a/ext/node/polyfills/internal/util/inspect.mjs b/ext/node/polyfills/internal/util/inspect.mjs index 671ab2acf..2d34db9c7 100644 --- a/ext/node/polyfills/internal/util/inspect.mjs +++ b/ext/node/polyfills/internal/util/inspect.mjs @@ -134,6 +134,7 @@ const inspectDefaultOptions = { colors: false, showProxy: false, breakLength: 80, + escapeSequences: true, compact: 3, sorted: false, getters: false, |
