diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-18 04:28:09 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-20 15:14:46 +0300 |
commit | 4b7a530f2b1a789b3feb64e3698d61b4ccc6bab5 (patch) | |
tree | 1cd8dd1d0ff4c113081502ddca54d5f9c7be8cb4 /lib/internal/console | |
parent | 6f8ccef74ec514292ebf8ee65602d8c109b0aa2b (diff) |
lib: switch to object spread where possible
Use the object spread notation instead of using Object.assign.
It is not only easier to read it is also faster as of V8 6.8.
PR-URL: https://github.com/nodejs/node/pull/25104
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib/internal/console')
-rw-r--r-- | lib/internal/console/constructor.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 7e1bcf802f8..e10eef74c24 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -294,10 +294,11 @@ Console.prototype.warn = function warn(...args) { Console.prototype.error = Console.prototype.warn; Console.prototype.dir = function dir(object, options) { - options = Object.assign({ - customInspect: false - }, this[kGetInspectOptions](this._stdout), options); - this[kWriteToConsole](kUseStdout, util.inspect(object, options)); + this[kWriteToConsole](kUseStdout, util.inspect(object, { + customInspect: false, + ...this[kGetInspectOptions](this._stdout), + ...options + })); }; Console.prototype.time = function time(label = 'default') { |