diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-20 17:36:57 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-27 22:36:47 +0100 |
commit | 4ea2c1c192f21f786e7ceac91a73e78044c6838d (patch) | |
tree | 6e772b67833a18872a66312892400822b98e1abc /lib | |
parent | 5ac30c99a9cc92f563655709d61e47729d441f62 (diff) | |
download | android-node-v8-4ea2c1c192f21f786e7ceac91a73e78044c6838d.tar.gz android-node-v8-4ea2c1c192f21f786e7ceac91a73e78044c6838d.tar.bz2 android-node-v8-4ea2c1c192f21f786e7ceac91a73e78044c6838d.zip |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/console/constructor.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index e10eef74c2..84339310f0 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -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)); |