-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util: change inspect depth default #17907
Changes from 4 commits
94b7b01
2d845cf
2721767
606f06c
3ca34ca
8ab8726
e220598
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ const { | |
|
||
const inspectDefaultOptions = Object.seal({ | ||
showHidden: false, | ||
depth: 2, | ||
depth: null, | ||
colors: false, | ||
customInspect: true, | ||
showProxy: false, | ||
|
@@ -317,8 +317,7 @@ Object.defineProperty(inspect, 'defaultOptions', { | |
if (options === null || typeof options !== 'object') { | ||
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'options', 'Object'); | ||
} | ||
Object.assign(inspectDefaultOptions, options); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for not using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The type check has to be done again in that case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I doubt it will add a noticeable overhead but yes it makes sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the use _extend as it will still be faster than Object.assign There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. About the performance - just recently I heard that |
||
return inspectDefaultOptions; | ||
return _extend(inspectDefaultOptions, options); | ||
} | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d just use
util.inspect.custom
here, it saves people looking at this code one round-trip to another fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done