Skip to content

Commit 8c06fd3

Browse files
committed
console: use spread notation instead of Object.assign
1 parent 21c0a0e commit 8c06fd3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/internal/console/constructor.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,15 @@ Console.prototype.table = function(tabularData, properties) {
434434
const final = (k, v) => this.log(cliTable(k, v));
435435

436436
const inspect = (v) => {
437-
const opt = { depth: 0, maxArrayLength: 3 };
438-
if (v !== null && typeof v === 'object' &&
439-
!isArray(v) && ObjectKeys(v).length > 2)
440-
opt.depth = -1;
441-
Object.assign(opt, this[kGetInspectOptions](this._stdout));
437+
const depth = v !== null &&
438+
typeof v === 'object' &&
439+
!isArray(v) &&
440+
ObjectKeys(v).length > 2 ? -1 : 0;
441+
const opt = {
442+
depth,
443+
maxArrayLength: 3,
444+
...this[kGetInspectOptions](this._stdout)
445+
};
442446
return util.inspect(v, opt);
443447
};
444448
const getIndexArray = (length) => ArrayFrom({ length }, (_, i) => inspect(i));

0 commit comments

Comments
 (0)