console: use spread notation instead of Object.assign
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
5ac30c99a9
commit
4ea2c1c192
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user