From dce37dc35b48f1de9f69e11e68deae73a20b6c7a Mon Sep 17 00:00:00 2001 From: "Sakthipriyan Vairamani (thefourtheye)" Date: Tue, 14 Feb 2017 07:28:56 +0530 Subject: [PATCH] lib: remove unnecessary assignments with _extend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first parameter to `util._extend` is the target object. Assigning the target object to the result of `util._extend` is not necessary. PR-URL: https://github.com/nodejs/node/pull/11364 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Yuta Hiroto Reviewed-By: Michaƫl Zasso Reviewed-By: Brian White --- lib/_http_agent.js | 4 ++-- lib/_tls_wrap.js | 4 ++-- lib/child_process.js | 2 +- lib/internal/cluster/master.js | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/_http_agent.js b/lib/_http_agent.js index eebdb24246..ace5923b45 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -121,7 +121,7 @@ Agent.prototype.addRequest = function addRequest(req, options) { } options = util._extend({}, options); - options = util._extend(options, this.options); + util._extend(options, this.options); if (!options.servername) { options.servername = options.host; @@ -176,7 +176,7 @@ Agent.prototype.addRequest = function addRequest(req, options) { Agent.prototype.createSocket = function createSocket(req, options, cb) { var self = this; options = util._extend({}, options); - options = util._extend(options, self.options); + util._extend(options, self.options); if (!options.servername) { options.servername = options.host; diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index a2236ef17c..394a34c51c 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -978,9 +978,9 @@ function normalizeConnectArgs(listArgs) { // the host/port/path args that it knows about, not the tls options. // This means that options.host overrides a host arg. if (listArgs[1] !== null && typeof listArgs[1] === 'object') { - options = util._extend(options, listArgs[1]); + util._extend(options, listArgs[1]); } else if (listArgs[2] !== null && typeof listArgs[2] === 'object') { - options = util._extend(options, listArgs[2]); + util._extend(options, listArgs[2]); } return (cb) ? [options, cb] : [options]; diff --git a/lib/child_process.js b/lib/child_process.js index f98cc3d5c7..9ca5189a73 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -147,7 +147,7 @@ exports.execFile = function(file /*, args, options, callback*/) { } if (pos < arguments.length && typeof arguments[pos] === 'object') { - options = util._extend(options, arguments[pos++]); + util._extend(options, arguments[pos++]); } else if (pos < arguments.length && arguments[pos] == null) { pos++; } diff --git a/lib/internal/cluster/master.js b/lib/internal/cluster/master.js index 97a7138174..af421a0418 100644 --- a/lib/internal/cluster/master.js +++ b/lib/internal/cluster/master.js @@ -48,8 +48,8 @@ cluster.setupMaster = function(options) { execArgv: process.execArgv, silent: false }; - settings = util._extend(settings, cluster.settings); - settings = util._extend(settings, options || {}); + util._extend(settings, cluster.settings); + util._extend(settings, options || {}); // Tell V8 to write profile data for each process to a separate file. // Without --logfile=v8-%p.log, everything ends up in a single, unusable @@ -110,7 +110,7 @@ function createWorkerProcess(id, env) { var execArgv = cluster.settings.execArgv.slice(); var debugPort = 0; - workerEnv = util._extend(workerEnv, env); + util._extend(workerEnv, env); workerEnv.NODE_UNIQUE_ID = '' + id; for (var i = 0; i < execArgv.length; i++) {