Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Added support for options parameter in console.dir() #7754

Closed

Conversation

xavimb
Copy link

@xavimb xavimb commented Jun 8, 2014

Solved issue: #5428. Now console.dir() accepts an optional parameter to define the maximum depth, colors and showHidden of the output.

this._stdout.write(util.inspect(object, { customInspect: false }) + '\n');
Console.prototype.dir = function(object, options) {
if (util.isObject(options)) {
options.customInspect = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be using util._extend() here. Modifying user-supplied object is not really a good idea.

@indutny
Copy link
Member

indutny commented Jun 8, 2014

Generally looks good, but could you please take a look at https://github.com/joyent/node/blob/master/CONTRIBUTING.md and fix the commit log, and sign CLA?

This features comes from the need of adding extra options when displaying
the object using console.dir().

console.dir() accepts now a second parameter that is passed to util.inspect()
in order to provide extra options to the output. These options are: depth, color
and showHidden. More information about these options in util.inspect() documentation.
@xavimb
Copy link
Author

xavimb commented Jun 8, 2014

I signed CLA and changed the method to use util._extend()

@indutny
Copy link
Member

indutny commented Jun 12, 2014

Thank you, landed with minor style fixes in 1cd48c7.

@indutny indutny closed this Jun 12, 2014
@xavimb xavimb deleted the feature/console-dir-accepts-options branch June 12, 2014 18:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants