Skip to content

Commit 561c268

Browse files
BridgeARtargos
authored andcommitted
console: use spread notation instead of Object.assign
PR-URL: #25149 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
1 parent e182ca9 commit 561c268

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
@@ -411,11 +411,15 @@ Console.prototype.table = function(tabularData, properties) {
411411
const final = (k, v) => this.log(cliTable(k, v));
412412

413413
const inspect = (v) => {
414-
const opt = { depth: 0, maxArrayLength: 3 };
415-
if (v !== null && typeof v === 'object' &&
416-
!isArray(v) && ObjectKeys(v).length > 2)
417-
opt.depth = -1;
418-
Object.assign(opt, this[kGetInspectOptions](this._stdout));
414+
const depth = v !== null &&
415+
typeof v === 'object' &&
416+
!isArray(v) &&
417+
ObjectKeys(v).length > 2 ? -1 : 0;
418+
const opt = {
419+
depth,
420+
maxArrayLength: 3,
421+
...this[kGetInspectOptions](this._stdout)
422+
};
419423
return util.inspect(v, opt);
420424
};
421425
const getIndexArray = (length) => ArrayFrom({ length }, (_, i) => inspect(i));

0 commit comments

Comments
 (0)