| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2a0b1ec commit cb4b89c
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2622,6 +2622,14 @@ function isBelowBreakLength(ctx, output, start, base) { | |||
| 2622 | 2622 | // TODO(BridgeAR): Add unicode support. Use the readline getStringWidth | |
| 2623 | 2623 | // function. Check the performance overhead and make it an opt-in in case it's | |
| 2624 | 2624 | // significant. | |
| 2625 | + // allow the single-line format if the length limit is infinite and no items have newlines | ||
| 2626 | + if (ctx.breakLength === Infinity) { | ||
| 2627 | + if (base !== '' && StringPrototypeIncludes(base, '\n')) return false; | ||
| 2628 | + for (let i = 0; i < output.length; i++) { | ||
| 2629 | + if (typeof output[i] === 'string' && StringPrototypeIncludes(output[i], '\n')) return false; | ||
| 2630 | + } | ||
| 2631 | + return true; | ||
| 2632 | + } | ||
| 2625 | 2633 | let totalLength = output.length + start; | |
| 2626 | 2634 | if (totalLength + output.length > ctx.breakLength) | |
| 2627 | 2635 | return false; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4064,3 +4064,9 @@ ${error.stack.split('\n').slice(1).join('\n')}`, | |||
| 4064 | 4064 | assert.match(inspect(DOMException.prototype), /^\[object DOMException\] \{/); | |
| 4065 | 4065 | delete Error[Symbol.hasInstance]; | |
| 4066 | 4066 | } | |
| 4067 | + | ||
| 4068 | + { | ||
| 4069 | + const obj = { a: 'short string', b: [1, 2], c: { d: true } }; | ||
| 4070 | + const expected = "{ a: 'short string', b: [ 1, 2 ], c: { d: true } }"; | ||
| 4071 | + assert.strictEqual(util.inspect(obj, { breakLength: Infinity }), expected); | ||
| 4072 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments