GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — util: add util.inspect compact option by BridgeAR · Pull Request #17576 · nodejs/node Conversation
|
|
I pushed another commit that changes the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Two small typos in the first commit message: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The current default formatting is not ideal and this improves the situation by formatting the output more intuitiv. 1) All object keys are now indented by 2 characters instead of sometimes 2 and sometimes 3 characters. 2) Each object key will now use an individual line instead of sharing a line potentially with multiple object keys. 3) Long strings will now be split into multiple lines in case they exceed the "lineBreak" option length (including the current indentation). 4) Opening braces are now directly behind a object property instead of using a new line.
util.inspect can actually receive any property and the description was wrong so far. This fixes it by renaming the argument to value and also updating the description.
Using a custom inspect function on the inspected object is deprecated. Remove the reference from the option description to make sure the user will read about the deprecation in the more detailed description.
In case the structured option is used, it will now print
"[Function: foo] {\n property: 'data'\n}"
instead of
"{ [Function: foo]\n property: 'data'\n}"
0f8cae2 to
cd5be74
Compare
|
I updated the commit message accordingly. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@BridgeAR I’m a fan of this feature, but not so sure about the name – “structured” doesn’t say that much, I think… it’s hard to come up with something better. I’ve thought about “long”, which also seems to have potential for confusion but is more to the point, I think. Maybe |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@addaleax yeah, the name is probably not ideal. What do you think about |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@BridgeAR Me neither, but I’d rather have something that actually tells you what’s happening And beauty is definitely in the eye of the beholder ;) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Maybe make an option called |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Trott that would also work but it somehow sounds "less good". And I personally prefer the new formatting a lot over the current one. If it is abot me I would just replace it ^^. But even though the output is considered to be changed from time to time, I guess that would be to harsh. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@BridgeAR OK, but I do think we need a better term than |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
So I thought about it again and what do you think about |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think I actually like |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I agree that |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 'NotStringClass {}'); | ||
| } | ||
|
|
||
| { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It looks like none of the examples here test objects with a custom inspect method. Can you add some coverage in for that?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I changed the name to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const averageLineLength = Math.ceil(value.length / Math.ceil(value.length / minLineLength)); | ||
| const divisor = Math.max(averageLineLength, MIN_LINE_LENGTH); | ||
| var res = ''; | ||
| if (readableRegExps[divisor] === undefined) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can you add {} for multi-line if bodies? :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This does not land cleanly on v9.x. Would someone be willing to backport? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Using a custom inspect function on the inspected object is deprecated. Remove the reference from the option description to make sure the user will read about the deprecation in the more detailed description. PR-URL: nodejs#17576 Reviewed-By: Anna Henningsen <[email protected]>
util.inspect can actually receive any property and the description was wrong so far. This fixes it by renaming the argument to value and also updating the description. PR-URL: nodejs#17576 Reviewed-By: Anna Henningsen <[email protected]>
The current default formatting is not ideal and this improves
the situation by formatting the output more intuitiv.
1) All object keys are now indented by 2 characters instead of
sometimes 2 and sometimes 3 characters.
2) Each object key will now use an individual line instead of
sharing a line potentially with multiple object keys.
3) Long strings will now be split into multiple lines in case
they exceed the "lineBreak" option length (including the
current indentation).
4) Opening braces are now directly behind a object property
instead of using a new line.
5) Switch inspect "base" order. In case the compact option is set
to `false`, inspect will now print
"[Function: foo] {\n property: 'data'\n}"
instead of
"{ [Function: foo]\n property: 'data'\n}".
PR-URL: nodejs#17576
Reviewed-By: Anna Henningsen <[email protected]>
|
Backport opened in #19230 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Using a custom inspect function on the inspected object is deprecated. Remove the reference from the option description to make sure the user will read about the deprecation in the more detailed description. Backport-PR-URL: #19230 PR-URL: #17576 Reviewed-By: Anna Henningsen <[email protected]>
util.inspect can actually receive any property and the description was wrong so far. This fixes it by renaming the argument to value and also updating the description. Backport-PR-URL: #19230 PR-URL: #17576 Reviewed-By: Anna Henningsen <[email protected]>
The current default formatting is not ideal and this improves
the situation by formatting the output more intuitiv.
1) All object keys are now indented by 2 characters instead of
sometimes 2 and sometimes 3 characters.
2) Each object key will now use an individual line instead of
sharing a line potentially with multiple object keys.
3) Long strings will now be split into multiple lines in case
they exceed the "lineBreak" option length (including the
current indentation).
4) Opening braces are now directly behind a object property
instead of using a new line.
5) Switch inspect "base" order. In case the compact option is set
to `false`, inspect will now print
"[Function: foo] {\n property: 'data'\n}"
instead of
"{ [Function: foo]\n property: 'data'\n}".
Backport-PR-URL: #19230
PR-URL: #17576
Reviewed-By: Anna Henningsen <[email protected]>
Using a custom inspect function on the inspected object is deprecated. Remove the reference from the option description to make sure the user will read about the deprecation in the more detailed description. Backport-PR-URL: #19230 PR-URL: #17576 Reviewed-By: Anna Henningsen <[email protected]>
util.inspect can actually receive any property and the description was wrong so far. This fixes it by renaming the argument to value and also updating the description. Backport-PR-URL: #19230 PR-URL: #17576 Reviewed-By: Anna Henningsen <[email protected]>
The current default formatting is not ideal and this improves
the situation by formatting the output more intuitiv.
1) All object keys are now indented by 2 characters instead of
sometimes 2 and sometimes 3 characters.
2) Each object key will now use an individual line instead of
sharing a line potentially with multiple object keys.
3) Long strings will now be split into multiple lines in case
they exceed the "lineBreak" option length (including the
current indentation).
4) Opening braces are now directly behind a object property
instead of using a new line.
5) Switch inspect "base" order. In case the compact option is set
to `false`, inspect will now print
"[Function: foo] {\n property: 'data'\n}"
instead of
"{ [Function: foo]\n property: 'data'\n}".
Backport-PR-URL: #19230
PR-URL: #17576
Reviewed-By: Anna Henningsen <[email protected]>
Notable changes:
* assert:
- From now on all error messages produced by `assert` in strict mode
will produce a error diff. (Ruben Bridgewater)
#17615
- From now on it is possible to use a validation object in throws
instead of the other possibilities. (Ruben Bridgewater)
#17584
* crypto:
- allow passing null as IV unless required (Tobias Nießen)
#18644
* fs:
- support as and as+ flags in stringToFlags() (Sarat Addepalli)
#18801
* tls:
- expose Finished messages in TLSSocket (Anton Salikhmetov)
#19102
* tty:
- Add getColorDepth function to determine if terminal supports colors
(Ruben Bridgewater) #17615
* util:
- add util.inspect compact option (Ruben Bridgewater)
#17576
* **Added new collaborators**
- [watson](https://github.com/watson) Thomas Watson
PR-URL: #19428
Notable changes:
* assert:
- From now on all error messages produced by `assert` in strict mode
will produce a error diff. (Ruben Bridgewater)
#17615
- From now on it is possible to use a validation object in throws
instead of the other possibilities. (Ruben Bridgewater)
#17584
* crypto:
- allow passing null as IV unless required (Tobias Nießen)
#18644
* fs:
- support as and as+ flags in stringToFlags() (Sarat Addepalli)
#18801
* tls:
- expose Finished messages in TLSSocket (Anton Salikhmetov)
#19102
* tty:
- Add getColorDepth function to determine if terminal supports colors
(Ruben Bridgewater) #17615
* util:
- add util.inspect compact option (Ruben Bridgewater)
#17576
* **Added new collaborators**
- [watson](https://github.com/watson) Thomas Watson
PR-URL: #19428
|
Requested backport to 8.x in #19230 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.