diff --git a/lib/console.js b/lib/console.js index 4ac0634eee221b..0310cbae40ce8d 100644 --- a/lib/console.js +++ b/lib/console.js @@ -162,6 +162,25 @@ Console.prototype.dir = function dir(object, options) { }; +Console.prototype.dirxml = function dirxml(...data) { + const optionProps = ['showHidden', 'depth', 'colors'], + maybeOptions = Object.getOwnPropertyNames(data.slice(-1)), + isOption = maybeOptions.some((p) => optionProps.indexOf(p) !== -1); + let options = { customInspect: false }; + + if (isOption) { + options = Object.assign(data.splice(-1), options); + } + for (const item of data) { + write(this._ignoreErrors, + this._stdout, + util.inspect(item, options), + this._stdoutErrorHandler, + this[kGroupIndent]); + } +}; + + Console.prototype.time = function time(label = 'default') { // Coerces everything other than Symbol to a string label = `${label}`;