Skip to content

Commit

Permalink
console: use spread notation instead of Object.assign
Browse files Browse the repository at this point in the history
  • Loading branch information
BridgeAR committed Dec 23, 2018
1 parent 21c0a0e commit 8c06fd3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,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));
Expand Down

0 comments on commit 8c06fd3

Please sign in to comment.