Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 561c268

Browse filesBrowse 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
Copy full SHA for 561c268

File tree

Expand file treeCollapse file tree

1 file changed

+9
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-5
lines changed
Open diff view settings
Collapse file

‎lib/internal/console/constructor.js‎

Copy file name to clipboardExpand all lines: lib/internal/console/constructor.js
+9-5Lines changed: 9 additions & 5 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.