diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 1090f8fde68d1f..dcfb5f4a70a826 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -411,11 +411,15 @@ Console.prototype.table = function(tabularData, properties) { const final = (k, v) => this.log(cliTable(k, v)); const inspect = (v) => { - const opt = { depth: 0, maxArrayLength: 3 }; - if (v !== null && typeof v === 'object' && - !isArray(v) && ObjectKeys(v).length > 2) - opt.depth = -1; - Object.assign(opt, this[kGetInspectOptions](this._stdout)); + const depth = v !== null && + typeof v === 'object' && + !isArray(v) && + ObjectKeys(v).length > 2 ? -1 : 0; + const opt = { + depth, + maxArrayLength: 3, + ...this[kGetInspectOptions](this._stdout) + }; return util.inspect(v, opt); }; const getIndexArray = (length) => ArrayFrom({ length }, (_, i) => inspect(i));